mysqldump: Got error: 1146: Table doesnt exist when using LOCK TABLES

灰暗的星星灰暗的星星灰暗的星星灰暗的星星灰暗的星星
 
分类:技术文章

[Email Question]

Hi, after a restore of a system failure now mysqldump give me an error of this type:

mysqldump: Got error: 1146: Table ‘wordpress.wp_bpspro_db_backup’ doesn’t exist when using LOCK TABLES

-- MySQL dump 10.13 Distrib 5.5.37, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: wordpress
-- ------------------------------------------------------
-- Server version 5.5.37-0ubuntu0.12.04.1-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

In my database this table does not exist, and the system doesn’t allow to create a table with this name.
Can you give me some idea?
Thanks


Problem was resolved by doing these steps.

My case was exactly what is describe in this post:  http://www.linux.org/threads/resolving-mysql-error-1146-table-doesnt-exist-when-doing-backup.2480/

mysqlcheck -u mysql_username -p database_name -> it’s give me that the table does not exists

show tables; -> it’s give me that the table is in list
i dropped the table with command “drop table table_name;” and then “show tables,” does not list it anymore.

From that moment mysqldump works fine.

Another method instead of a command line method to do the same thing would be to use phpMyAdmin and run an SQL Query.

Click the SQL tab in phpMyAdmin
Type: show tables
Click the Go button to run the SQL Query
If you see this error message below…
database_name.table_name
Error: Table ‘database_name.table_name’ doesn’t exist
status: Operation failed
Note:  database_name and table_name are just an example database name and an example table name.  You will see your actual database name and table name.
…click the phpMyAdmin SQL tab again.
Type (enter your actual table_name):  drop table table_name
Click the Go button to run the SQL Query and drop/delete the corrupt database table.