Database query failed. Error received from database was #144: Table 'dbname.mantis_bug_file_table' is marked as crashed and last (automatic?) repair failed for the query: SELECT bug_id, COUNT(bug_id) AS attachments
FROM mantis_bug_file_table
GROUP BY bug_id.
How to avoid above issue. Many times I got this error after repair table. If I repair table after loading the page it's says "#2013 - Lost connection to MySQL server during query".
Thanks.
Stop MySQL process first.Go to your data folder and try running myisamchk -r <table_name>. If it is not work then try with myisamchk -r -v -f <table_name>.
Related
Starting mariadb in arch linux results in "Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist" on systemctl logs
When installing the package, there's a notice that I didnt read about "You need to initialize the MariaDB data directory prior to starting
the service. This can be done with mariadb-install-db command, e.g.:
mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql"
Just do that and you'll get it.
I tried everything, changing the port no. and all but it still did not start I had to end the mysql process using the activity monitor and now the tables wont respond. When I click the name it shows an error message: #1146 table 'table_name' doesn't exist!
My past projects will be wasted if they don't respond and I had forgotten to export the databases.
you can run this command to repair any database you have:
mysqlcheck -u mysql_username -p database_name
but if you see this error after running this:
Error: Table 'database_name.table_name' doesn't exist
you should drop your damaged table, all details can you find through this link
I run a WordPress website. Today I found that wp_posts table is crashed. When I tried to repair the table, I got the following error:
REPAIR TABLE wp_posts;
error Can't create new tempfile: './[databasename]/wp_posts.TMD'
repair status Operation failed
I tried to run the following command in shell:
myisamchk -r -f wp_posts.MYI
error: File 'wp_posts.MYI' doesn't exist
Can you please tell me what else I can try to fix this problem?
Turned out that "myisamchk -r -f wp_posts.MYI" was the correct solution. I just had to go to the data folder.
In my CentOS system, I changed directory to /var/lib/mysql/[database]/and found wp_posts.MYI
After removing this file, repair was successful.
Try stopping your service using the following command sudo service mysql stop
Now do the repair check myisamchk -r -f -o /var/lib/mysql/DatabaseName/wp_posts
Start your service and enjoy it!
It works for me
Try adding the following line to your wp-config.php file:
define( 'WP_ALLOW_REPAIR', true );
Then go to:
/wp-admin/maint/repair.php
That should take effect and automatically repair your crashed table.
For mariaDB and some other combination of OS and DB version, the file may also be located under /config/databases/[DATABASE].
Try to run as root (sudo su):
service mysql stop
myisamchk -rf /config/databases/[databasename]/wp_posts.MYI
service mysql start
I just had the same trouble. The problem was the .TMD file already existed and mysqlrepair refused to overwrite it. I removed the .TMD file and the mysqlrepair worked famously. I had to stop the process attempting to use the crashed table, then run the repair.
When I saw this error in phpMyadmin, I got around it by navigating to /var/lib/mysql/[database]/ and deleting the TMD file for the table I was trying to repair (not the MYI file as stated in the explanation above).
When I tried getting rid of the MYI file, the repair operation didn't work.
When i perform any procedure creation or update operation to mysql DB, i am getting the below error
Table './mysql/proc' is marked as crashed and should be repaired
Tried to run mysql isam recover using below command -
myisamchk -q -r /var/lib/mysql/mysql/proc
But the issue still persists.
Thanks in Advance.
Try these:
mysqlcheck --auto-repair -A -u username -ppassword
Inside MySQL terminal
repair table mysql.proc;
Reference: https://dev.mysql.com/doc/refman/5.1/en/repair-table.html
Modify the my.cnf
[mysqld]
character-sets-dir=/usr/share/mysql/charsets
Reference: http://dev.mysql.com/doc/refman/5.0/en/repair-table.html
The above answer also applicable to other business related tables -
example -
Table './dev/bank_accounts' is marked as crashed and should be repaired
Can be resolved by following command in mysql prompt.
repair table 'dev.bank_accounts';
Internally, mysql trys to recover the data from MyISAM storage engine of mysql.
Caution - Please take a back up of the table before doing a repair, As the repair might cause a data loss.
Go to structure of the table and scroll down and click on optimize option. It will repair your table and will fix this issue.
I was repairing this table suddenly server hanged and when I returned back all tables are ok but this one showing 'in use' and when I try to repair it doesn't proceed.
ERROR 144 - Table './extas_d47727/xzclf_ads' is marked as crashed and last (automatic?) repair failed
What can I do to repair it?
If your MySQL process is running, stop it. On Debian:
sudo service mysql stop
Go to your data folder. On Debian:
cd /var/lib/mysql/$DATABASE_NAME
Try running:
myisamchk -r $TABLE_NAME
If that doesn't work, you can try:
myisamchk -r -v -f $TABLE_NAME
You can start your MySQL server again. On Debian:
sudo service mysql start
Try running the following query:
repair table <table_name>;
I had the same issue and it solved me the problem.
This was my experience resolving this issue. I'm using XAMPP.
I was getting the error below
Fatal error: Can't open and lock privilege tables: Table '.\mysql\db' is marked as crashed and last (automatic?) repair failed
This is what I did to resolve it, step by step:
went to location C:\xampp\mysql, For you, location may be different, make sure you are in right file location.
created backup of the data folder as data-old.
copied folder "mysql" from C:\xampp\mysql\backup
pasted it inside C:\xampp\mysql\data\ replacing the old mysql folder.
And it worked. Keep in mind, I have already tried around 10 solutions and they didnt work for me. This solutions may or may not work for you but regardless, make backup of your data folder before you do anything.
Note: I would always opt to resolve this with repair command but in my case, i wasnt able to get mysql started at all and i wasnt able to get myisamchk command to work.
Regardless of what you do, create a periodic backup of your database.
If it gives you permission denial while moving to /var/lib/mysql then use the following solution
$ cd /var/lib/
$ sudo -u mysql myisamchk -r -v -f mysql/<DB_NAME>/<TABLE_NAME>
I needed to add USE_FRM to the repair statement to make it work.
REPAIR TABLE <table_name> USE_FRM;
I got myisamchk: error: myisam_sort_buffer_size is too small as error.
The solution
myisamchk -r -v mysql/<DB_NAME>/<TABLE_NAME> --sort_buffer_size=2G
Go to data_dir and remove the Your_table.TMP file after repairing <Your_table> table.
If this happend to your XAMPP installation, just copy global_priv.MAD and global_priv.MAI files from ./xampp/mysql/backup/mysql/ to ./xampp/mysql/data/mysql/.
Without stopping the database I go to this folder
cd /var/lib/mysql/$DATABASE_NAME
and then execute the following command
myisamchk -r -v -f $TABLE_NAME
Without having any issue the command successfully completed and resolve the issue
Thank you
I tried the options in the existing answers, mainly the one marked correct which did not work in my scenario. However, what did work was using phpMyAdmin. Select the database and then select the table, from the bottom drop down menu select "Repair table".
Server type: MySQL
Server version: 5.7.23 - MySQL Community Server (GPL)
phpMyAdmin: Version information: 4.7.7
This is a 100% solution. I tried it myself.
myisamchk -r -v -f --sort_buffer_size=128M --key_buffer_size=128M /var/lib/mysql/databasename/tabloname
enter to your mysql and select your database
then
repair table ;
this work with me