Solutions for Tableisreadonly in mysql _ MySQL-mysql tutorial

Source: Internet
Author: User
Tags drupal
Summary of solutions for Tableisreadonly in mysql bitsCN.com if it is a database in use, some class problems suddenly occur.
Run the following command in Linux. of course, you need to find your mysql directory.

Linux

/Usr/local/mysql/bin/mysqladmin-u root-p flush-tables

Windows
Run lush-tables in cmd.
You can also directly modify the repair table in phpmyadmin.

If you want to import and restore data
Therefore, all the table files under the database folder chmod into 777, chown into "_ mysql", but this time the problem is more serious, the real table crached in drupal. No way. Google immediately finds that it is easy to solve the problem.
First, locate the location of mysqladmin, which is generally under mysql/bin, and then run the following command:

./Mysqladmin-u root-p flush-tables

Then, enter the password of the root account. it will be ready immediately. if there is no prompt, re-open drupal. everything works.
This time, we also found the correct permission settings for the database file: database folder 700 under data, table file 660, and all files should be owned by mysql.

The following problems occur when the Windows database is transferred to the linux server:

A Discuz forum was originally deployed in windows and uses GBK encoding. the MYSQL version is 5.0.
Now I need to transfer it to Linux. I would have recommended using mysqldump to export the data, but my colleagues want to directly use the database directory under the data Directory.

First, try to create a database on the new server and then move the old directory.

In mysql, Select and other operations are normal, but the webpage program prompts: Table 'cdb _ posts' is read only

Change the user and group of the database directory to mysql, and add the 777 permission.

The same is prompted when the root connection is used in the program.

If you want to use myisamchk to check it, the read only message is also displayed.

Finally found the solution: http://www.mysqltalk.org/re-the-table-is-read-only-vt154092.html

Reference
I just encountered a similar problem on one of my production servers
This morning. (I'm still investigating the cause.) After doing
Quick bit of Google-searching, this solved my problem:

Mysqladmin-u -P flush-tables

By the way: All directories in/var/lib/mysql shocould have 700
Permissions (owned my the mysql user) and everything within those
Directories shoshould be 660 (owned by the mysql user and mysql group ).

After flush-tables is run, the read only problem is solved :)

Then I found that there was still a problem with the data structure and content. I used myisamchk to check the error. later I used mysqldump for export. However, I still encountered a lot of problems because the database to be transferred was quite large and it took a long time, it does not continue.
Learn some knowledge points and record them as follows:

That is, the settings for default-charact exported by mysql5 are not supported by mysql4. you need to add the skip-opt parameter, for example:
Mysqldump-uroot-p -- default-character-set = gbk-skip-opt databse> hx. SQL
Reference: Mysql database character set conversion

Finally, I found a mysql5 server and exported it with mysqldump. mysql was imported, once successfully!
I found that I used mysqldump to export a table, with more than million records. it took more than 4 minutes to use it. I processed more than 1 million records per second. that's quick! It took about 10 minutes to import, and thousands of entries were imported every second. :) bitsCN.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.