Tag Archives: mysqldump

[Solved] Backup mysql8.0 with the mysqldump of mysql5.7 Error

Use mysql5 The mysqldump command of version 7 backs up mysql8 An error will be reported when using the 0 version of the database:

mysqldump: Couldn't execute 'SET SQL_QUOTE_SHOW_CREATE=1/*!40102 ,SQL_MODE=concat(@@sql_mode, _utf8 ',NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS') */': Variable 'sql_mode' can't be set to the value of 'NO_KEY_OPTIONS' (1231)

The solution is as follows:

The first way is to upgrade MySQL 5 Version 7 database to MySQL 8.0 0, and then use the same command to back up

The second way is not to use MySQL 5 Version 7 database comes with the mysqldump command, but find a mysql8 Upload the mysqldump command file of version 0 database to the specified path of the host, and then use mysqldump under this path for backup operation

The second method is recommended

View the current mysqldump version command

# mysqldump --version
mysqldump  Ver 10.13 Distrib 5.7.35, for Linux (x86_64)

# mysqldump --version
mysqldump  Ver 8.0.25 for Linux on x86_64 (MySQL Community Server - GPL)

mysqldump Backup Error: mysqldump: Got error: 1449: The user specified as a definer (‘xxx’@’%’) does not exist when using LOCK TABLES

1. Find XXX user and find that it does not exist

select user,host from mysql. user;

The XXX user who created the view before has been deleted

2. Find these views and modify the definer information

select concat(“alter_definer=`root`@`%` view “, table_name, ” as “, view_definition, “;”)
from information_ schema. views
where table_schema='< Your database name> ‘;

The above SQL will generate a statement to modify the definer, which can be executed

How to Sovle mysqldump backup Error on the MySQL command line

Today, when I was backing up with mysqldump, an error occurred. The following is my command for backing up the database:

mysql> mysqldump -hlocalhost -uroot -p myempoyees  student > "D:/backup/file.sql";

The following error reports occur:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL 
server version for the right syntax to use near 'mysqldump -hlocalhost -uroot -p myempoyees  student > 
"D:/backup/file.sql"' at line 1

But the command should be right

The result of online query: mysqldump is not a MySQL command, but a command line user program, which must be called by shell command line.

Execute the statement in the shell command window without entering the MySQL command

C:\Program Files\MySQL\MySQL Workbench 8.0>mysqldump -hlocalhost -uroot -p myempoyees  student >"D:/backup/file.sql"
Enter password: ******
C:\Program Files\MySQL\MySQL Workbench 8.0>

Enter the password and the backup is successful!

Solution to empty backup file generated by mysqldump scheduled task

Problem: after writing a mysqldump backup script and executing it directly, the backup file can be generated normally, but the backup file generated when running a scheduled task is empty

 

Analysis reason: since mysqldump exists under the bin of the global environment variable mysql, the mysqldump command can be recognized when running directly, but the mysqldump command cannot be recognized in the scheduled task. (PS: crontab running failure is basically caused by environment variables)

Solution: just add the absolute path before the mysqldump command

 

Mysqldump common error reports and Solutions

Mysqldump failure cases and solutions:

1.mysqldump: Error 2020: Got packet bigger than ‘max_allowed_packet’ bytes when dumping table `blt_Bulletinannex ` at row: 626
error reporting condition: generally, there are blob, text and other fields, and a single record exceeds the default 24m
solution: increase mysqldump by max_allow_Packet parameter. It is invalid to modify this parameter on the server

2. Mysqldump: couldn’t execute ‘show table status like’ members\_ban\_user\_view”: SELECT command denied to user ”@’%’ for column ‘user_id’ in table ‘members_ban_Log ‘(1143)
error reporting condition: the permission given to the account of the corresponding view is insufficient; Or the user does not exist
solution: you need to define the create of the account in the view_view_Priv and show_view_Priv authority; Or add corresponding users and permissions; Delete the view

3. Mysqldump: couldn’t execute ‘show create table ` InnoDB_index_stats`’: Table ‘MySQL.innodb_index_Stats’ doesn’t exist (1146)
error condition: mysql5.6, the system table is damaged, and the table is an InnoDB engine
solution: physically delete the frm file and IBD file of the table, find the definition SQL of the system table, and rebuild the system table

4. Mysqldump: couldn’t execute ‘show create table ` view_all_packages`’: View ‘locker.view_all_Packages’ references invalid table (s) or column (s) or function (s) or definer/invoker of view pack rights to use them (1356)
error condition: illegal view definition
solution: delete or modify the problematic view definition statement

5. Mysqldump: got error: 1045: access denied for user ‘ucloudbackup’ @ ‘10.10.1.242’ (using password: Yes) when t Rying to connect
error conditions: unable to connect, problems with password, account, host and port
solution: first ensure that MySQL can connect normally

6. Mysqldump: couldn’t execute ‘show create table ` userarena log’: table ‘./tank_11/userarena log ‘is marked as crashed and should be repaired (145)
error reporting condition: MyISAM table is damaged
solution: repair table XXX repair the damaged table. You’d better mysqlcheck all tables

7. Mysqldump: couldn’t execute’ show fields from ` TB_CROWDFUNDING_PROJECT`’: Incorrect key file for table ‘ql-5.5/14310da6-644a-472a-b170-0e7e75cfda87/tmp/#sql_32606_0.MYI’; Try to repair it (126)
error reporting condition: the TMP space is insufficient during the use of the temporary table, Cause damage to MyISAM temporary table
solution: increase disk space

8. Mysqldump: couldn’t execute ‘show function status where DB =’ analysis’ ‘: cannot load from mysql.proc. The table is potentially corrupted (1548)
error condition: upgrade causes
solution: run mysql_Upgrade update dB, or update the mysql.proc table structure of the corresponding version
5.1 execute
alter table mysql.proc modify column ` comment`   char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL AFTER `sql_mode`;
5.5 execute
alter table mysql.proc modify column ` comment`   text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL AFTER `sql_mode`;

9. Mysqldump: couldn’t execute ‘show events’: cannot proceed because system tables used by event scheduler were found damaged at server start (1577)
error reason: unreasonable upgrade of MySQL version leads to
solution: MySQL first_Upgrade, no, restart DB again (not sure)

10. Mysqldump: couldn’t execute ‘show function status where DB =’ MySQL ”: you have an error in your SQL syntax; Check the manual that responses to your MySQL server version for the right syntax to use near ” at line 1 (1064)
error reason: select * from information_Schema.routes limit 1 reports the same error
looking at the mysql.proc table, it is found that there is a problem with the definition of a function or stored procedure. For example, the nonexistent dB or user appears in the definition. It is speculated that the – R parameter is not added during backup,
solution: try drop syntax to delete the function or stored procedure records with problems defined in mysql.proc. If not, directly delete from

11. Mysqldump: error 2013: lost connection to MySQL server during query when dumping table ` vitality_Flow ` at row: 31961089
error reason: 1 this table is a partition table   2 the table is InnoDB, and there are a large number of blob text and other fields. 3 upload NFS or compress while backup  
solution: for the reasons of 1 and 3, the net should be increased_write_Timeout parameter; For the reason of 2, it is necessary to increase max_allow_packet;

12.mysqldump: Couldn’t execute ‘SELECT DISTINCT TABLESPACE_NAME, FILE_NAME, LOGFILE_GROUP_NAME, EXTENT_SIZE, INITIAL_SIZE, ENGINE FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = ‘DATAFILE’ AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN (‘15616156′,’mysql’,’test’,’wx00′,’wx01′,’wx02′,’wx03′,’wxid’)) ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_Name ‘: lost connection to MySQL server during query (2013)
error reason: oom due to insufficient memory during backup
solution: increase memory

 

13.mysqldump: Couldnt execute show create table `shop_his_9`: Deadlock found when trying to get lock; try restarting transaction (1213) fails

Error reporting reason: deadlock occurred during mysqldump

Solution: try again

 

14.mysqldump: Got error: 1049: Unknown database cfcara when selecting the database fails

Reason for error reporting: it is caused by case sensitivity problem of arbitrary modification

Solution: solve the case problem first

mysqldump: Couldn’t execute ‘STOP SLAVE SQL_THREAD’: Access denied for user ‘root’@’172.19.%.%’ (using password: NO) (1045)

Reason for error reporting: backup from the database. The backup account has insufficient permissions and cannot log in

 

mysqldump: Couldnt execute show create table `sk_order_38`: Unable to open underlying table which is differently defined or of non-MyISAM type or doesnt exist (1168) fails

Error reason: it is caused by an error in the definition of MRG table

 

Solution: delete this table

  Original blog:

http://blog.csdn.net/cug_jiang126com/article/details/49359699

Mysqldump backup problems got error: 1045, error 1045 (28000), got error: 1449

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

Question 1: type the command mysqldump – uroot (user name) – proot (password) Pref_ 123456 (database name) & gt/ Root/a.sql: mysqldump: got error: 1045: access denied for user ‘root’ @’localhost ‘(using password: Yes) when trying to connect

Solution: modify/etc/my.cnf configuration, add the following statement [mysqldump] user = root —- backup user name, password = root # — user password, and then restart MySQL or LNMP LNMP restart problem 2. When you type the command MySQL – uroot – proot, the error is as follows: error 1045 (28000): access denied for user ‘root’ @’localhost ‘(using password: Yes)

Or enter the server IP in the browser http://123.207.231.39 : 8001/phpMyAdmin/the error is as follows:

Solutions: 1. In the installation directory of MySQL, find the configuration file my.ini of MySQL, add skip grant tables under [mysqld], save and restart mysql

2. After that, enter MySQL – uroot – P in CMD, press enter, and password will appear. If you directly enter, you can successfully log in to MySQL, and 1405 will not be reported

3. Display MySQL > In the command line, enter use mysql, press enter, and then enter update user set password = password (“new password”) where user = root

4. Enter flush privileges( Refresh the database), and then enter quit; Or exit( Exit database)

5. The last step is to delete or comment out the skip grant tables in my.ini. Then restart mysql. After that, login with MySQL – uroot – ppassword, and you won’t report 1405 again

Question 3. Type the command mysqldump – uroot – proot Pref_ 827146 >/Root/aa.sql, the error is as follows:

mysqldump: [Warning] Using a password on the command line interface can be insecure.

mysqldump: Got error: 1449: The user specified as a definer (‘dev’@’%’) does not exist when using LOCK TABLES!

Enter picture description

Solution: as long as the root user can add a permission to all hosts, the operation is as follows: log in to MySQL

mysql -u root -pPasswd

mysql > grant all privileges on . to root@”%” identified by “Passwd”

mysql > flush privileges;

============== END~! Ko. Then export it to execute