如何锁定所有表,或整个库?

uranuswang 2012-11-08 02:57:47
我要对数据库进行一下数据库文件的备份,所以需要暂时锁定所有的表、备份、在解锁,表的引擎为MyISAM。
在网上找了半天都是对单个表的锁定,给各位大侠帮忙!
...全文
120 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
uranuswang 2012-11-08
  • 打赏
  • 举报
回复
谢谢你!结分了。
uranuswang 2012-11-08
  • 打赏
  • 举报
回复
我知道了,用下面的语句就好了。 ================================ FLUSH TABLES WITH READ LOCK; UNLOCK TABLES;
uranuswang 2012-11-08
  • 打赏
  • 举报
回复
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4015 Server version: 5.5.24-log Source distribution Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved
WWWWA 2012-11-08
  • 打赏
  • 举报
回复
MYSQL什么版本 ?
uranuswang 2012-11-08
  • 打赏
  • 举报
回复
mysql> lock tables WRITE; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WRITE' at line 1 mysql> lock tables read; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read' at line 1 mysql> lock tables LOW_PRIORITY WRITE; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LOW_PRIORITY WRITE' at line 1 mysql> LOCK TABLES; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 mysql>
uranuswang 2012-11-08
  • 打赏
  • 举报
回复
不行。 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
WWWWA 2012-11-08
  • 打赏
  • 举报
回复
LOCK TABLES 不行?

56,678

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧