CentOS command line for MySQL database import and export

On centos, you can use the command line to back up the mysql database, you can use mysqldump.

The mysqldump tool is a small tool that comes with mysql. Like mysql, it belongs to the application. Switch to the mysql directory and do the following:

 

1. Backup the entire database directly

mysqldump -uroot -p --default-character-set=utf8 piwik > piwik_bak.sql

 

2. Only need to create a table command

mysqldump -uroot -p --default-character-set=utf8 -d piwik > piwik_bak.sql

 

3. Just insert data

mysqldump -uroot -p --default-character-set=utf8 -t piwik > piwik_bak.sql

 

4. Backup single sheet

mysqldump -uroot -p --default-character-set=utf8 piwik piwik_user > piwik_user_bak.sql

Backup the piwik_user table of the piwik database

 

5. Backup multiple tables

mysqldump -uroot -p --default-character-set=utf8 piwik piwik_user piwik_site > piwik_user_bak.sql

Backup the piwik_user and piwik_site tables of the piwik database

 

6. Remote Backup

mysqldump -h ip -uroot -p --default-character-set=utf8 piwik > piwik_bak.sql

 

7. Import

mysql > source /root/piwik_bak.sql

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326250697&siteId=291194637
Recommended