MySQL Data Backup Commands


mysql
MySQL Data Backup For Users Converting To Normal Text
SELECT * FROM table_name INTO OUTFILE ‘/tmp/tutorials.csv’;

Exporting Tables As Raw Data
mysqldump -u root -p –no-create-info  –tab=/tmp DATABASE table_name;

Backup For All Databases
mysqldump -u root -p –all-databases > database_dump.sql

Copying Database to Another Host
mysqldump -u root -p database_name  | mysql -h other-host.com database_name

Importing Data With Load Data
LOAD DATA LOCAL INFILE ‘dump.txt’ INTO TABLE mytbl;

Importing Data With MySQLImport
mysqlimport -u root -p –local database_name file_name

How To Backup Multiple MySQL Databases Into a Single File
mysqldump -u [username] p[password] all-databases > [dump_file.sql]

Advertisements