Got error:1556:you can ' t use locks with log tables

Source: Internet
Author: User

Original link: http://oldboy.blog.51cto.com/2561410/1122867

MySQL master-Slave synchronization error Resolution An example: this article from the old boy Linux operation and maintenance of actual training inside the content of teaching plan summary

FAQ: Problem 1:mysqldump:got error:1556:you can ' t use locks with log tables.

In the old boy with the students from the synchronization practice, found that students practice operation encountered the following problems can not be solved, so the old boy to solve the process summarized 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

Resolution process:

The same operation, the other 10 students are OK, only the student has a problem, after questioning, and after viewing the relevant configuration process, contact to the previous period also has students have similar problems, so, found the reason.

[Root@oldboy ~]# which mysqldump

/usr/bin/mysqldump

Find the reason, MySQL installation path is/application/mysql, view mysqldump path should be/application/mysql/bin only right, but now the path is the RPM package installed MySQL command path, to this reason found.

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

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

In the/etc/profile file, the MySQL command is on the path, and the student is put to the end, so when the mysqldump command is executed, the/usr/bin/mysqldump command with the RPM package is first found, causing the error.

We put the MySQL command path to the front 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

At this point in the export database:

[Root@oldboy ~] #mysqldump-uroot-p ' Oldboy '-s/data/3306/mysql.sock-a-B >a.sql

You can export it normally.

Below this schoolmate searches, other Netizen's same error to complain another question article:

Mysqldump 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

A recent error occurred while making a database backup:

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 (the legendary. sh file), and when I put these
Mysqldump statement separate one execution, I found that there is no error, so I found some information on the network:
The discovery is logs tables in the MySQL default database (such as Slow_log and General_log) and cannot be caused by lock (lock tables).
So I tested a bit, the MySQL about the default database-related statements emptied, the entire file can be run normally.
There is also a workaround:
Is in MySQL This database related sentence mysqldump add--lock-tables=0 This parameter, does not lock the table to back up, is also feasible.

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.