出現場景
在 cmd 導出數據庫時:
mysqldump -hlocalhost -uroot -p student_db > C:\student_db.sql
出現:
mysqldump: Got error: 1146: Table 'student_db.student' doesn't exist when using LOCK TABLES
解決過程
網上說鎖定所有表即可解決,即:
--lock-all-tables,-x
mysqldump -hlocalhost -uroot -p -x student_db > C:\student_db.sql
然而我的情況並沒有解決。
查看出現問題的數據表:
use student_db;
show tables;
-- student 存在
select * from student;
show create table student;
-- 上面兩個都提示:ERROR 1146 (42S02): Table 'student_db.student' doesn't exist
結論
重啟 MySQL,再次進入時 OK。