Home > Article > Operation and Maintenance > Detailed analysis of import and export of MySQL backup in Linux system
How to import and export backup of MySQL in ECS Linux system.
Export of MySQL backup
MySQL backup import
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
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!