I watched the cacti monitoring today and found that no data was obtained yesterday.
Check the log and a large number of errors occur: SQL assoc failed !, Error: '20140901 ',
An error occurred while displaying the SQL Execution results,
For example, the display table poller_output needs to be repaired. I checked many examples on the Internet and tried to solve the problem,
Then the query is normal:
Solve the problem.
Which of the following are found online:
Bytes -------------------------------------------------------------------------------------------------------------
These things are all found from other places to solve the MySQL database error method, does not necessarily apply to the miracle database, just for reference, the specific solution still needs to be explored. Or any of these methods can be applied to the database. I do not have a conditional test. If I have a conditional test, it is expected to solve the problem that the database reports this error.
(1)
When I browsed my blog last night, I suddenly found that all the pages could not be displayed. When I checked it in the background, an error "Table 'xxx' is marked as crashed and shocould be retried red" is found. Quickly search the Internet. It was easy to modify this serious error:
1. Go to phpMyAdmin to manage MySQL
2. Select your database on the left.
3. Check the 'xxx' table in the error message on the right.
4. Scroll down the screen to the bottom. There is a drop-down menu (with selected :) and select "repair table"
After the modification, no data loss was found, and a database was quickly backed up to the email, which is still very important!
(2)
Symptom:
Mysql> Use yourealcn
Database changed
Mysql> Select User, company from biz_user where commend = '1' order by regtime DESC, checked DESC limit 0, 5;
Error 145 (hy000): Table './yourealcn/biz_user' is marked as crashed and shoshould be retried red
Mysql> exit
Run the myisamchk command to restore the myi file of the database.
#/Usr/local/mysql5/bin/myisamchk-c-r/bak/lib/MySQL/yourealcn/biz_user .*
Myisamchk: Error: '/bak/lib/MySQL/yourealcn/biz_user.frm' is not a MyISAM-table
---------
Myisamchk: Error: '/bak/lib/MySQL/yourealcn/biz_user.myd' is not a MyISAM-table
---------
-Recovering (With sort) MyISAM-table '/bak/lib/MySQL/yourealcn/biz_user.myi'
Data Records 20414
-Fixing Index 1
-Fixing index 2
-Fixing index 3
-Fixing index 4
(3)
Caused by: Java. SQL. sqlexception: Table 'table name' is marked as crashed and shoshould be retried red
Solution:
./Myisamchk-c-r database table myi file path (for example,/home/MySQL/var/crawlerfeedsky/AAAA. myi)
If not, force-F to fix it.
(4)
I checked it on the server today and found a webpage error. I cannot connect to the database server. After the MySQL service is down, restart the server and find that the webpage cannot be opened. The prompt is [MySQL] Table tblname is marked as crashed and shoshould be retried red.
MySQL prompts that the tblname table is corrupted and needs to be repaired. solution:
Enter the corresponding database directory:
CD/var/lib/MySQL/dbname
Use myisamchk to fix the problem:
Shell> myisamchk-r tblname
(5)
The fix command I used is myisamchk-r bbsthreads.
Among them, bbsthreads is the name of the table with a problem. Of course, you have to use this command to enter the storage path of the table in the database with a problem in MySQL. For more detailed commands, see help: myisamchk -- help;
If you cannot solve the problem by using the above command, please refer to the following content.
My website has a problem. When I access the website, an error is displayed in full screen. Check the MySQL Log. The error message is:
Table '. \ dedecmsv4 \ dede_archives' is marked as crashed and shoshould be retried red
Prompt that the CMSArticleThe table dede_archives is marked with a problem and needs to be fixed. As a result, the system quickly restored historical data and went online to find the cause. Finally, the problem is solved. The solution is as follows:
Find the bin/myisamchk tool in the MySQL installation directory, and enter:
Myisamchk-c-r ../data/dedecmsv4/dede_archives.myi
Then the myisamchk tool will help you restore the index of the data table. Restart MySQL to solve the problem.
Problem Analysis:
1. Cause of the Error. Some netizens say that the index error is caused by frequent queries and updates to the dedede_archives table. Because my page is not generated statically but is a dynamic page, I agree with this statement. It is also said that the MySQL database is damaged for some reason, such: sudden Power outages on the database server and operations on the table's original files when providing services on the database table may cause damage to the MySQL database table and the data cannot be read. In short, the table is damaged due to some unpredictable problems.
The problem number is 145.
2. Solutions.
There are three repair types when you try to fix a broken table. If you get an error message indicating that a temporary file cannot be created, delete the file indicated by the Information and try again-this is typically left behind by the last repair operation.
The three methods are as follows:
% Myisamchk -- recover -- quick/path/to/tblname
% Myisamchk -- recover/path/to/tblname
% Myisamchk -- safe-Recover/path/to/tblname
The first is the fastest, which is used to fix the most common problems, and the last is the slowest, which is used to fix problems that cannot be fixed by other methods.
Check and repair Mysql Data Files
If the above method cannot repair a damaged table, you can try the following two tips before giving up:
If you suspect that the index file of the table (*. myi) an irreparable error occurs, or even this file is lost. You can use the data file (*. MYD) and Data Format File (*. FRM. Create a copy of the data file (tblname. MYD. Restart your MySQL service and connect to the service. Run the following command to delete the table content:
Mysql> Delete from tblname;
When deleting the table content, a new index file is created. Log out and close the service again, and overwrite the new (empty) data file with the data file (tblname. MYD) You just saved. Finally, use myisamchk to execute the standard repair (the second method above) and regenerate the index data based on the table data content and the table format file.
If your table format file (tblname. FRM) is lost or an irreparable error occurs, but you know how to use the corresponding create table statement to regenerate the table, you can regenerate a new one. FRM files are used together with your data files and index files (if there is a problem with the index file, use the above method to recreate a new one. Create a copy of the data and index file, and then delete the original file (delete all records related to the table in the data directory ).
Start MySQL and use the original create table file to create a new table. The new. frm file should work properly, but you 'd better execute the Standard fix (the second method above ).
3. myisamchk tool Introduction (see the MySQL official manual)
You can use myisamchk for practical purposes.ProgramTo obtain information about database tables or to check, repair, and optimize them. Myisamchk applies to MyISAM tables (tables corresponding to. myi and. MYD files ).
Call the myisamchk method:
Shell> myisamchk [Options] tbl_name...
Options specifies what you want myisamchk to do. Describe them later. You can also obtain the Option List by calling myisamchk -- help.
Tbl_name is the database table you want to check or repair. If you do not run myisamchk somewhere in the database directory, you must specify the path of the database directory because myisamchk does not know where your database is located. In fact, myisamchk does not care whether the file you are operating on is in a database directory; you can copy the file corresponding to the database table to another place and perform restoration operations there.
If you want to, you can use the myisamchk command line to name several tables. You can also specify a table by naming the index file (with the suffix ". myi. It allows you to specify all tables in a directory by using the "*. myi" mode. For example, if you are in the database directory, you can check all MyISAM tables in the directory as follows:
Shell> myisamchk *. myi
If you are not in the database directory, you can check all the tables in the directory by specifying the path:
Shell> myisamchk/path/to/database_dir/*. myi
You can even specify a wildcard for the path of the MySQL data directory to check all tables in all databases:
Shell> myisamchk/path/to/datadir/*. myi
We recommend that you quickly check all MyISAM tables:
Shell> myisamchk -- silent -- fast/path/to/datadir/*. myi
To check all MyISAM tables and repair any damaged tables, run the following command:
Shell> myisamchk -- silent -- force -- fast -- Update-state \
-O key_buffer = 64 m-o sort_buffer = 64 m \
-O read_buffer = 1 m-o write_buffer = 1 m \
/Path/to/datadir/*. myi
This command assumes that you have a free memory larger than 64 MB. For more information, see section 5.9.5.5 "myisamchk memory usage ".
When running myisamchk, make sure other programs do not use tables. Otherwise, the following error message is displayed when you run myisamchk:
Warning: clients are using or haven't closed the table properly
This indicates that you are trying to check the table that is being updated by another program that has not closed the file or has been terminated but has not properly closed the file (for example, mysqld server.
If mysqld is running, you must use flush tables to forcibly clear any table that is still in memory for modification. When running myisamchk, make sure other programs do not use tables. The easiest way to avoid this problem is to use check table instead of myisamchk.