Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
1.1k views
in Q2A Core by

Running query: LOCK TABLES qa_users WRITE, qa_userlogins WRITE, qa_userprofile WRITE, qa_userfields WRITE, qa_cookies WRITE, qa_categories WRITE, qa_pages WRITE, qa_posts WRITE, qa_blobs WRITE, qa_words WRITE, qa_titlewords WRITE, qa_contentwords WRITE, qa_posttags WRITE, qa_uservotes WRITE, qa_userpoints WRITE, qa_userlimits WRITE, qa_iplimits WRITE, qa_options WRITE, qa_cache WRITE ...

8 upgrade step/s remaining...

Running query: CREATE TABLE qa_widgets (widgetid SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, place CHAR(2) CHARACTER SET ascii NOT NULL, position SMALLINT UNSIGNED NOT NULL, tags VARCHAR(800) CHARACTER SET ascii NOT NULL, title VARCHAR(80) NOT NULL, PRIMARY KEY (widgetid), UNIQUE position (position)) ENGINE=InnoDB CHARSET=utf8 ...


Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\qa\qa-include\qa-db-install.php:1019) in C:\xampp\htdocs\qa\qa-include\qa-install.php on line 60
Question2Answer was unable to perform the installation query below. Please check the user in the config file has CREATE and ALTER permissions:

CREATE TABLE qa_widgets (widgetid SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, place CHAR(2) CHARACTER SET ascii NOT NULL, position SMALLINT UNSIGNED NOT NULL, tags VARCHAR(800) CHARACTER SET ascii NOT NULL, title VARCHAR(80) NOT NULL, PRIMARY KEY (widgetid), UNIQUE position (position)) ENGINE=InnoDB CHARSET=utf8

Error 1100: Table 'qa_widgets' was not locked with LOCK TABLES

3 Answers

0 votes
by

This is a strange error - MySQL is asking you to lock a table before it even exists. As a workaround, try adding the following in qa-db-install.php:

qa_db_upgrade_query('UNLOCK TABLES');

Add it after the following line:

case 23:

Then try upgrading your database again.

by
i added the same query after case 24: also and it worked.
Thanks!!!
Its great to have such a quick response.
0 votes
by

same error...just it did one step

 

Running query: LOCK TABLES qa_users WRITE, qa_userlogins WRITE, qa_userprofile WRITE, qa_userfields WRITE, qa_cookies WRITE, qa_categories WRITE, qa_pages WRITE, qa_widgets WRITE, qa_posts WRITE, qa_blobs WRITE, qa_words WRITE, qa_titlewords WRITE, qa_contentwords WRITE, qa_posttags WRITE, qa_uservotes WRITE, qa_userpoints WRITE, qa_userlimits WRITE, qa_iplimits WRITE, qa_options WRITE, qa_cache WRITE ...

7 upgrade step/s remaining...

Running query: CREATE TABLE qa_tagwords (postid INT UNSIGNED NOT NULL, wordid INT UNSIGNED NOT NULL, KEY postid (postid), KEY wordid (wordid), CONSTRAINT qa_tagwords_ibfk_1 FOREIGN KEY (postid) REFERENCES qa_posts(postid) ON DELETE CASCADE, CONSTRAINT qa_tagwords_ibfk_2 FOREIGN KEY (wordid) REFERENCES qa_words(wordid)) ENGINE=InnoDB CHARSET=utf8 ...


Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\mobi-x\qa-include\qa-db-install.php:1020) in C:\xampp\htdocs\mobi-x\qa-include\qa-install.php on line 60
Question2Answer was unable to perform the installation query below. Please check the user in the config file has CREATE and ALTER permissions:

CREATE TABLE qa_tagwords (postid INT UNSIGNED NOT NULL, wordid INT UNSIGNED NOT NULL, KEY postid (postid), KEY wordid (wordid), CONSTRAINT qa_tagwords_ibfk_1 FOREIGN KEY (postid) REFERENCES qa_posts(postid) ON DELETE CASCADE, CONSTRAINT qa_tagwords_ibfk_2 FOREIGN KEY (wordid) REFERENCES qa_words(wordid)) ENGINE=InnoDB CHARSET=utf8

Error 1100: Table 'qa_tagwords' was not locked with LOCK TABLES

0 votes
by
edited by

got the same error upgrading from version 1.3.3 to 1.4.1:

 

Warning: Cannot modify header information - headers already sent by (output started at ...\qa-include\qa-db-install.php:1019) in ...\qa-include\qa-install.php on line 60
body, input { font-size: 16px; font-family: Verdana,Arial,Helvetica,sans-serif; }body { margin: 64px auto; text-align: center; width: 640px; }table { margin: 16px auto; }


Question2Answer was unable to perform the installation query below. Please check the user in the config file has CREATE and ALTER permissions:

CREATE TABLE qa_tagwords (postid INT UNSIGNED NOT NULL, wordid INT UNSIGNED NOT NULL, KEY postid (postid), KEY wordid (wordid), CONSTRAINT qa_tagwords_ibfk_1 FOREIGN KEY (postid) REFERENCES qa_posts(postid) ON DELETE CASCADE, CONSTRAINT qa_tagwords_ibfk_2 FOREIGN KEY (wordid) REFERENCES qa_words(wordid)) ENGINE=InnoDB CHARSET=utf8

Error 1005: Can't create table 'q2a.qa_tagwords' (errno: 150)

 



Solved: My problem was related to the "wrong" database type. I don't know why but instead of InnoDB I had MyISAM as database type which doesn't support structural integrity over foreign keys...
...