Mysqldump instances and mysqldump instances are excluded from database backup.

Source: Internet
Author: User

Mysqldump instances and mysqldump instances are excluded from database backup.

Note:

Use mysqldump-all-databases to export all databases. However, if the master node dumps data from the master database, we do not need or want information_schema or mysql database. When there are few databases, you can also use/usr/local/mysql/bin/mysqldump-uroot-p -- databases db1 db2> db1db2. SQL is re-exported in this way, but if there are too many data, it is very troublesome to specify this.

Mysql supports ignore-table, but does not have ignore-database. Therefore, if you want to export all databases except information_schema and mysql databases, can you only specify databases one by one?

Solution:

# Mysql-e "show databases;"-uroot-p | grep-Ev "Database | information_schema | mysql | test" | xargs mysqldump-uroot-p -- databases> mysql_dump. SQL

Appendix:

Appendix 1: mysqldump: Got error: 1142: SELECT, lock tabl command denied to user 'root' @ 'localhost' for table 'cond _ instances' when using LOCK TABLES

Performance_schema is added to mysql5.5. When we perform mysqldump, the following error message is returned:

Mysqldump: Got error: 1142: SELECT, lock tabl command denied to user 'root' @ 'localhost' for table 'cond _ instances' when using LOCK TABLES

We can add the parameter-skip-lock-tables in mysqldump, as shown in

# Mysqldump-uroot-p -- skip-lock-tables performance_schema> performance_schema. SQL or filter out the performance_schema Database

# Mysql-e "show databases;"-uroot-p | grep-Ev "Database | information_schema | mysql | test | performance_schema" | xargs mysqldump-uroot-p -- databases> mysql_dump. SQL

In the above mysqldump backup database, it is excluded that some database instances are all the content shared by Alibaba Cloud xiaobian. I hope you can provide a reference and support for the customer's house.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.