删除 mysql.general_log table 时出错

Getting Error while deleting mysql.general_log table

5,执行以下查询时出错,

delete from mysql.general_log

执行上述查询后出错,

Error Code: 1556
You can't use locks with log tables.

谁能帮我解决上面的错误。

我认为您可以先重命名 table,然后尝试将其删除,然后还原,即,将 table 名称改回原来的名称。

第二个alternative solution是这样的:

You may need to disable “–lock-tables” option on your dump statement ie –lock-tables=0 . What my assumption is when we use “–lock-tables” option, the current table which is being backed up will be operating on “read only” mode to avoid further write operations during the time. The cached query which containing “write’ operation will be executed later once after the table dump has been done. Pls note that skipping this option is not recommended in production mode.

I made this changes because of since the Amazon RDS does allow only remote access even though I set daily backup and retention period in RDS web interface properly. This custom backup is taken for my surety even though AWS RDS handle it better.

$mysqldump –all-database –lock-tables=0 -uusername -h hostname -p’password’ -B | bzip2 > /backup/db/domain-00-00.2012.bz2

要清除 Table 中的所有数据,您可以使用

截断 mysql.general_log

mysqldump -u dbUsername -p dbPassword --lock-tables=0> data.sql

对我来说很好。