illustrate: Using mysqldump –all-databases will export all libraries. But if we are doing master-slave, when dumping data from the master database, we do not need or want the information_schema and mysql libraries. If there are few databases, you can export them through /usr/local/mysql/bin/mysqldump -uroot -p --databases db1 db2 > db1db2.sql. However, if there are a lot of data, it will be troublesome to specify it in this way. MySQL supports ignore-table, but not ignore-database. So if we want to export all libraries except information_schema and mysql, can we only specify databases one by one? solve: # 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 In MySQL 5.5, performance_schema was added. When we perform mysqldump, the following error message will be reported: 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 to mysqldump, such as # mysqldump -uroot -p --skip-lock-tables performance_schema > performance_schema.sql or filter out the performance_schema library # mysql -e "show databases;" -uroot -p| grep -Ev "Database|information_schema|mysql|test|performance_schema" | xargs mysqldump -uroot -p --databases > mysql_dump.sql The above example of excluding certain libraries when backing up the database with mysqldump is all I have to share with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Implementation example of video player based on Vue
>>: Nginx learning how to build a file hotlink protection service example
1. Create a shell script vim backupdb.sh Create t...
In a cluster with master-slave replication mode, ...
1. Arrange CSS in alphabetical order Not in alphab...
This article example shares the specific code of ...
Preface Since vue3.0 was officially launched, man...
As the first article of this study note, we will ...
BMP is an image file format that is independent o...
Many times when learning web page development, th...
This article shares with you how to use thinkphp5...
Table of contents Preface Demonstration effect HT...
This article mainly explains the style of buttons...
When we use the MySQL service, under normal circu...
What is HTML? HTML is a language used to describe...
Table of contents Why use gzip compression? nginx...
[mysql] replace usage (replace part of the conten...