How to Solve MySQL Error Message : mysqldump : Got error: Table table_name doesn’t exist when using LOCK TABLES

Posted on

This is an article where the focus is to avoid the error message triggered upon executing ‘mysqldump’ command. So, in order to keep the dump process to run and to avoid the error message as shown in the title of the article about how to solve MySQL error message caused in the mysqldump process where the table is considered doesn’t exist because of the LOCK_TABLES, just do the following alternative solution :

user@hostname:~$ mysqldump -uroot -p --all-databases > /home/user/all-database.sql
Enter password: 
mysqldump: Got error: 1146: Table 'deploy.account_emailaddress' doesn't exist when using LOCK TABLES
user@hostname:~$ cd 
Description : 
mysqldump : the command tool to dump database
-uroot : it is an additional parameter added along with the value of it to describe user used for connecting to the MySQL Database Server
-p : it is an additional parameter added for specifying the command to execute it for inserting password interactively. 
--all-databases : it is an additional parameter for specifying the dump process is implemented to all databases exist. 
> : it is the redirect output which is used to pass any output generated before the '>' sign to anything defined after the '>' sign. 
/home/user/all-database.sql : the target of file defined to store the output generated before the '>' which is located in '/home/user/all-database.sql'.  

One of the solution taken to skip the table where it is considered as doesn’t exist when using LOCK TABLES is by all means just add the additional parameter to skip it. Below is the actual command of the above command which is modified in order to skip the non-existent table because it considered in the condition of LOCK TABLES. Just add -skip-lock-tables

user@hostname:~$ mysqldump -uroot -p --all-databases --skip-lock-tables > /home/user/all-database.sql
Enter password: 
Error: Couldn't read status information for table account_emailaddress ()
mysqldump: Couldn't execute 'show create table `account_emailaddress`': Table 'deploy.account_emailaddress' doesn't exist (1146)
user@hostname:~$ 

The process still keep continue on although several tables cannot be dumped because of the error happened in the first command execution. By adding the additional parameter -skip-lock-tables, the process can still be continued on.

Leave a Reply