title: MySQL #1100 - Table 'USER' was not locked with LOCK TABLES
body: <p>I am having a very strange problem. I have developed a database and it works perfectly on my local server however then I tried to put it online on my server I keep getting MySQL error:</p>
  
  <pre><code>#1100 - Table 'USER' was not locked with LOCK TABLES
  </code></pre>
  
  <p>(This is then I try to import my .sql file via phpMyAdmin)  </p>
  
  <p>Once again this same script gives no errors on my local server (WAMP server)</p>
  
  <p>I have no Idea why it does not work then I try to put it online. Also it creates the tables and structure the problem is only with the insert statements.</p>
  
  <p>SQL script:  </p>
  
  <pre><code>/*!40101 SET NAMES utf8 */;
  
  /*!40101 SET SQL_MODE=''*/;
  
  /*!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 */;
  CREATE DATABASE /*!32312 IF NOT EXISTS*/`a3823833_MiniPos` /*!40100 DEFAULT CHARACTER SET latin1 */;
  
  USE `a3823833_MiniPos`;
  
  /*Table structure for table `user` */
  
  DROP TABLE IF EXISTS `user`;
  
  CREATE TABLE `user` (
    `userid` int(4) NOT NULL auto_increment,
    `username` varchar(20) NOT NULL,
    `password` varchar(20) NOT NULL,
    `email` varchar(50) NOT NULL,
    PRIMARY KEY (`userid`)  
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  /*Table structure for table `profile` */
  
  DROP TABLE IF EXISTS `profile`;
  
  CREATE TABLE `profile` (
    `userid` int(4) NOT NULL,
    `lastName` varchar(50),
    `firstName` varchar(50),
    `dob` varchar(10),
    PRIMARY KEY (`userid`),
    CONSTRAINT `profile_fk` FOREIGN KEY (`userid`) REFERENCES `user` (`userid`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  /*Table structure for table 'topic'*/
  
  DROP TABLE IF EXISTS `topic`;
  
  CREATE TABLE `topic` (
      `topicid` int(4) NOT NULL auto_increment,
      `userid` int(4) NOT NULL,
      `text` varchar(2000),
      `time` datetime,
      PRIMARY KEY (`topicid`),
      CONSTRAINT `userid_fk` FOREIGN KEY (`userid`) REFERENCES `user` (`userid`)
   )  ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  /* Table structure for table 'post'*/
  
  DROP TABLE IF EXISTS `post`;
  
  CREATE TABLE `post` (
      `postid` int(4) NOT NULL auto_increment,
      `topicid` int(4),
      `userid` int(4) NOT NULL,
      `text` varchar(2000),
      `time` datetime,
      PRIMARY KEY (`postid`),
      CONSTRAINT `post_userid_fk` FOREIGN KEY (`userid`) REFERENCES `user` (`userid`),
      CONSTRAINT `post_topicid_fk` FOREIGN KEY (`topicid`) REFERENCES `topic` (`topicid`)
  )   ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  
  
  LOCK TABLES `user` WRITE;
  INSERT INTO USER VALUES (1,'Martynas','MartynPass','Martyn@email.com'),(2,'Syed','SyedPass','Syed@email.com'),(3,'Stephanie','StephPass','Steph@email.com');
  UNLOCK TABLES;
  LOCK TABLES `topic` WRITE;
  INSERT INTO topic VALUES (1, 1,'Topic Number 1','2015-06-11 20:15:00'),(2, 2,'Topic Number 2','2015-06-10 19:15:00'),(3, 3,'Topic Number 3','2015-06-09 18:15:00');
  UNLOCK TABLES;
  LOCK TABLES `post` WRITE;
  INSERT INTO post VALUES (1, 1, 1, 'Very Interesting Topic Number 1','2015-06-11 20:15:00'),(2, 1, 2, 'Agree!','2015-06-11 21:15:00');
  UNLOCK TABLES;
  </code></pre>