MySQL备份报错mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES)
Error
Solution
Add -hlocalhost or -h20.0.0.51 to the command
If you only need to export the structure of the table, you can use the -d option of mysqldump
The table structure of the entire library is as follows:
mysqldump -uroot -p -d databasename > name.sql
What if you only want to export the table structure and data of tables test1, test2, and test3?
How to export?
mysqldump -uroot -p -d databasename test1 test2 test3 > createtab.sql
The above is to export the specified table structure, the following one can export the specified table structure and data
mysqldump -uroot -p --tables databasename > name.sql
mysqldump -uroot -p -d databasename test1 test2 test3 > all-data.sql
Of course you can also use this command
mysqladmin -uroot -p flush-logs '进行增量备份'