Backup Only Table from MySQL Database Using mysqldump
# mysqldump -u[uname] -p[pass] [dbname] > [backupfile.sql];
Example
mysqldump -uroot -pabcd shopmanagementdb > shopmanagementdbback.sql ;
Backup Only Table structure from MySQL Database Using mysqldump
# mysqldump -n -d -u[uname] -p[pass] [dbname] > [backupfile.sql];
Example
mysqldump -n -d -uroot -pabcd shopmanagementdb > shopmanagementdbback.sql ;
Backup Only Store procedure and function from MySQL Database Using mysqldump
# mysqldump -n -t -d --routines -u[uname] -p[pass] [dbname] > [backupfile.sql];
Example
mysqldump -n -t -d --routines -uroot -pabcd shopmanagementdb > shopmanagementdbback.sql;
Backup Table and Store Produce from MySQL Database Using mysqldump
# mysqldump --routines -u [uname] -p[pass] [dbname] > [backupfile.sql];
Example
mysqldump --routines -uroot -pabcd shopmanagementdb > shopmanagementdbback.sql ;
Backup Table and Store Produce and function from MySQL Database Using mysqldump for any language
# mysqldump --routines -u [uname] -p[pass] --default-character-set=utf8 [dbname] > [backupfile.sql];
Example
mysqldump --routines -uroot -pabcd --default-character-set=utf8 shopmanagementdb > shopmanagementdbback.sql;
Backup only Table data from MySQL Database Using mysqldump
# mysqldump -u [uname] -p[pass] -t [dbname] > [backupfile.sql];
Example
mysqldump -uroot -pabcd -t shopmanagementdb > shopmanagementdbback.sql ;
Backup specific Table data from MySQL Database Using mysqldump
# mysqldump -u [uname] -p[pass] -t [dbname] table1 table2 > [backupfile.sql];
Example
mysqldump -uroot -pabcd -t shopmanagementdb customer branch > shopmanagementdbback.sql ;
Restore MySQL Database
# mysql -u[uname] -p[pass] [dbname] < [backupfile.sql] ;
Example
mysql -uroot -pabcd shopmanagementdb < shopmanagementdbback.sql;
How to start/stop MySql server on Ubuntu, RedHat Linux and OSX
Debian / Ubuntu
# To install MySql database:sudo apt-get install mysql-server
# To check the status of MySql server:
/etc/init.d/mysql status
# To start MySql server:
/etc/init.d/mysql start
# To stop MySql server:
/etc/init.d/mysql stop
# To restart MySql server:
/etc/init.d/mysql restart
RedHat Linux (Fedora Core/Cent OS)
# To start mysql server:/etc/init.d/mysqld start
# To stop mysql server:
/etc/init.d/mysqld stop
# To restart mysql server
/etc/init.d/mysqld restart
OR
service:
# service mysqld start
# service mysqld stop
# service mysqld restart
OSX
# To check the status of MySql server:sudo /usr/local/mysql/support-files/mysql.server status
# To start mysql server:
sudo /usr/local/mysql/support-files/mysql.server start
# To stop mysql server:
sudo /usr/local/mysql/support-files/mysql.server stop
# To restart mysql server
sudo /usr/local/mysql/support-files/mysql.server restart
Subscribe to:
Posts (Atom)