我要对数据库进行一下数据库文件的备份,所以需要暂时锁定所有的表、备份、在解锁,表的引擎为MyISAM。
在网上找了半天都是对单个表的锁定,给各位大侠帮忙!

解决方案 »

  1.   

    不行。
    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
      

  2.   

    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> 
      

  3.   

    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 4015
    Server version: 5.5.24-log Source distributionCopyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved
      

  4.   

    我知道了,用下面的语句就好了。================================
    FLUSH TABLES WITH READ LOCK;
    UNLOCK TABLES;