Copyright note: This article is kept and original by the blogger. Please indicate the source for reprint
original address: https://blog.csdn.net/qq_ 38688267/article/details/117745441
Contents of articles
Scenario Description: find a solution on the network and use ‘mysqldump — all databases’ to back up the’ MySQL ‘library
Finally, the solution is summarized
Scene introduction
after installing mysql8, use mysqldump
command to backup data from mysql5.7, and then synchronize to mysql8. The specific orders are as follows:
mysqldump -uroot -p --all-databases > /root/dump.sql
then import the data into mysql8 through source
command. After the import, when querying the table list, mysql8 reports an error: MySQL E rror:The user specified as a definer (‘mysql.infoschema’@’localhost’) does not exist
。
Looking for solutions on the Internet
a slightly more reliable solution: https://blog.wmsay.com/article/44 . But it still doesn’t solve my problem…
Do it yourself
after careful thinking, I think that the problem may be in dump. SQL
, because I directly specified all databases libraries, which may be MySQL and information_ Schema
and other libraries are backed up, and then the data of these libraries in MySQL 8 is covered, resulting in an error.
in order to confirm my idea, I tried the mysqldump -- all databases
command locally and looked at the data in it:
Using mysqldump -- all databases
will back up the MySQL
library
will not back up information_ schema、performance_ Schema
library
Final solution
the reason is the data coverage of MySQL
database data mysql5.7, which is bound to have problems. Simply re install MySQL 8. Then dump the data again and specify the library to dump
mysqldump -uroot -p --databases mydb1 mydb2 > /root/dump.sql
Summary
when using mysqldump
, do not use the -- all databases
parameter lazily, but use the -- databases db1 DB2 db3
method to specify. Using mysqldump -- all databases
will back up the MySQL
library, which is prone to problems!
Read More:
- MySQL – ERROR 1146 (42S02): Table ‘mysql.user’ doesn’t exist
- MySQL connection error access denied for user ‘root’ @ ‘localhost‘
- Solve MySQL error 1698 (28000): access denied for user ‘root’ @’localhost ‘
- Error 1045 (28000) access denied for user ‘root’ @’localhost ‘appears in MySQL under Windows system
- [MySQL] error 1396 (HY000): Operation create user failed for ‘MySQL’ @’localhost ‘
- MySQL startup problem (ERROR 1045 (28000): Access denied for user’ODBC’@’localhost’ (using password: NO))
- ERROR 1044 (42000): Access denied for user ”@’localhost’ to database ‘mysql’
- Linux-mysql8.0 password reset problem – error 1396 (HY000): Operation alter user failed for ‘root’ @’localhost ‘
- The MySQL service suddenly hangs up with the error message can’t connect to MySQL server on ‘localhost’ (10061)
- MySQL Workbench Failed to Connect to MySQL at 127.0.0.1:3306 with user root Bad handshake
- How to Fix failed to Connect to MySQL at localhost:3306 with user root
- MYSQL login error: mysqladmin: connect to server at’localhost’ failed
- MySQL: if the remote connection using navicatip fails, prompt “is not allowed to connect to this MySQL server”
- Su – MySQL switch user, display error: resource temporarily unavailable
- mysql Table ‘performance_ schema.session_ Variables’ doesn’t exist solution
- Error 2003 (HY000): can’t connect to MySQL server on ‘localhost’ (10061)
- ERROR 2002 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)
- MySQL error set: failed to start mysql.service : Unit mysql.service is masked.
- MySQL uses net start MySQL startup prompt (failed to start, the service did not report any error)
- mysql problem solving: mysqladmin: connect to server at’localhost’ failed