Mysqldump: Got error: 1556: You can & #39; t use locks

Source: Internet
Author: User

Mysql master-slave synchronization error solution: This article is fromLinux O & M training for Old BoysSummary of internal teaching plan content

FAQ: Question 1: mysqldump: Got error: 1556: You can't use locks with log tables.

When the old boy took the students to master the synchronization practice, he found that the following problems could not be solved during the students' practice. Therefore, the old boy summarized the solution process as follows:

[Root @ Oldboy ~] # Mysqldump-uroot-p 'oldboy '-S/data/3306/mysql. sock-A-B> a. SQL

Mysqldump: Got error: 1556: You can't use locks with log tables. when using LOCK TABLES

Solution Process:

In the same operation, the other 10 students are OK. Only this student has a question. After asking, check the configuration process, some students encountered similar problems in the past, so they found the cause.

[Root @ Oldboy ~] # Which mysqldump

/Usr/bin/mysqldump

The installation path of mysql is/application/mysql. Check that the path of mysqldump is/application/mysql/bin, however, the current path is the mysql command path installed in the rpm package.

[Root @ oldboy ~] # Tail-1/etc/profile

Export PATH = $ PATH:/application/mysql/bin

In the/etc/profile file, the path of the mysql Command is located, and the student ends with it. Therefore, when the mysqldump command is executed, the/usr/bin/mysqldump command in the rpm package is found first, leading to errors.

We put the mysql command PATH at the beginning of the PATH variable:

[Root @ oldboy ~] # Tail-1/etc/profile

Export PATH =/application/mysql/bin: $ PATH

[Root @ Oldboy ~] #./Etc/profile

[Root @ Oldboy ~] # Echo $ PATH

/Application/mysql/bin:/Usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin: /usr/bin:/usr/local/mysql/bin:/root/bin:/usr/local/mysql/bin:/application/mysql5.1.65/bin: /application/apache/bin

[Root @ Oldboy ~] # Which mysqldump

/Application/mysql/bin/mysqldump

In this case, export the database:

[Root @ Oldboy ~] # Mysqldump-uroot-p 'oldboy '-S/data/3306/mysql. sock-A-B> a. SQL

It can be exported normally.

The following is an article about another problem reported by other netizens:

Mysqldump You can't use locks with log tables 11-01-13 11:05:02

Http://blog.chinaunix.net/uid-21757535-id-86425.html

Category: Mysql/postgreSQL

When I was backing up a database recently, I encountered the following error:

Mysqldump: Got error: 1556: You can't use locks with log tables. when using LOCK TABLES

I put some mysqldump statements in a batch command file named. sh), and when I put these
When the mysqldump statement was separated and executed one by one, I found that there were no errors, so I found some information on the Network:
It is found that the logs table in the default mysql database cannot be locked.
So I tested it. After clearing the statements related to the default mysql database, the entire file can run normally.
There is also a solution:
It is also feasible to add the -- lock-tables = 0 parameter to the mysql database-related statement without locking table backup.

This article from the "old boy linux O & M" blog, please be sure to keep this source http://oldboy.blog.51cto.com/2561410/1122867

Related Article

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.