Home >Operation and Maintenance >Linux Operation and Maintenance >Detailed analysis of import and export of MySQL backup in Linux system

Detailed analysis of import and export of MySQL backup in Linux system

黄舟
黄舟Original
2017-05-31 11:30:461854browse

Problem description


How to import and export backup of MySQL in ECS Linux system.

Processing method


  • Export of MySQL backup


  • MySQL backup import

MySQL backup export

Note:

  • If you are using the one-click environment configuration in the help center, then the installation directory of MySQL is /alidata/server/mysql.


  • If you install MySQL to another directory, you need to enter the complete installation path of your MySQL.

Single database backup, you can execute the following command on the server:

/alidata/server/mysql/bin/mysqldump -uroot -p密码 数据库名 > 备份名称.sql

mysqldump will not export the event table by default. Executing this command will appear Warning -- Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.

If you need to export MySQL events, you can execute the following command:

/alidata/server/mysql/bin/mysqldump -uroot -p密码 --events --ignore-table=mysql.event  数据库名 > 备份名称.sql

MySQL backup import

If you need to import the backup .sql file, you can execute the following command in the directory where the backup name .sql file is located:

/alidata/server/mysql/bin/mysql -uroot -p密码 mysql < 备份名称.sql

You can also pass Execute the following command:

/alidata/server/mysql/bin/mysql -uroot -p密码
mysql>use 数据库;   
mysql>source /root/备份名称.sql;

Note: /root/backup name.sql is the absolute path of the actual backup file

The above is the detailed content of Detailed analysis of import and export of MySQL backup in Linux system. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn