If you are using a database that suddenly appears to be a class problem
Under Linux to execute the following command on it, of course you have to find your MySQL directory
In Linux
Copy Code code as follows:
/usr/local/mysql/bin/mysqladmin-u root-p Flush-tables
In Windows
Can execute lush-tables in cmd
can also be modified in phpMyAdmin direct use of the repair table
If you are importing restore data
, so the database folder under all the table files chmod into 777,chown into "_mysql", but this problem is more serious, drupal inside the reality table crached. No way, immediately Google, found that the solution is quite easy.
First, find the location of the mysqladmin, usually under Mysql/bin, and then run the command:
Copy Code code as follows:
./mysqladmin-u Root-p Flush-tables
Then enter the password of the root account, immediately, without any hint, re-open Drupal, everything is OK.
Through this, also found the correct permissions of the database file settings: Data under the database Folder 700, table file 660, all files should be owned by MySQL.
This is also the problem of moving from the window database to the Linux server
A discuz forum, the original frame in Windows, with the GBK code, MySQL version is 5.0.
Now need to move to Linux, I originally suggested using the Mysqldump export method, but colleagues want to directly use the data directory of the database directory.
First try to move the directory, create the database on the new server, and then move the old directory over.
In MySQL, select is normal, but in the Web page program prompts: Table ' cdb_posts ' is read only
Change the users and groups that belong to the database directory to MySQL and add a 777 permission, or the same hint.
The root connection is used in the program, as is the same hint.
Want to use Myisamchk to check, also hint Read only.
Finally found a solution here: 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 a
Quick bit of google-searching, this solved my problem:
Mysqladmin-u <username>-P flush-tables
By the Way:all directories In/var/lib/mysql should have 700
Permissions (owned my MySQL user) and everything within those
Directories should is 660 (owned by the MySQL user and MySQL group).
After running flush-tables, read only problem solved:)
Then found that the data structure and content still have problems, with myisamchk error, and later use Mysqldump Guide, but also encountered a lot of problems, because the database to turn is very large, a long time, eventually did not go on.
Know some knowledge points, record:
is the MYSQL5 export of default-charact settings, MYSQL4 does not support, you need to add skip-opt parameters, such as:
Mysqldump-uroot-p--default-character-set=gbk-skip-opt databse > Hx.sql
Reference article: Mysql database Character Set conversion
Finally found a MYSQL5 server, with mysqldump export, MySQL import, a success!
Found with mysqldump export a table, more than 300w records, with only 4 minutes, processing 1w More records per second, fast! Import, almost more than 10 minutes, import thousands of per second is also very fast: