Error mysqld table is marked as crashed and should be repaired

I am getting this error in wordpress phpMyadmin #145 - Table './DB_NAME/wp_posts' is marked as crashed and should be repaired When I login to phpMyadmin, it says wp_posts is "in use" My website...

I am getting this error in wordpress phpMyadmin

#145 - Table './DB_NAME/wp_posts' is marked as crashed and should be repaired 

When I login to phpMyadmin, it says wp_posts is «in use»

My website is currently down because of this.

I googled this problem, but I don’t see the «repair» button on phpMyadmin. Please let me know how to fix this. I am not sure where to issue PHP command. Please advise, my proficiency with PHP is very basic.

Brian Tompsett - 汤莱恩's user avatar

asked Dec 5, 2010 at 3:51

John Connor's user avatar

0

Here is where the repair button is:

alt text

answered Dec 5, 2010 at 3:53

Nican's user avatar

NicanNican

7,7703 gold badges26 silver badges26 bronze badges

0

Run this from your server’s command line:

 mysqlcheck --repair --all-databases

answered Dec 5, 2010 at 3:53

tylerl's user avatar

tylerltylerl

29.8k13 gold badges78 silver badges112 bronze badges

3

I had the same issue when my server free disk space available was 0

You can use the command (there must be ample space for the mysql files)

REPAIR TABLE `<table name>`;

for repairing individual tables

John's user avatar

John

12.3k12 gold badges94 silver badges163 bronze badges

answered Nov 13, 2013 at 13:39

Arun Killu's user avatar

Arun KilluArun Killu

13.3k5 gold badges33 silver badges59 bronze badges

2

Connect to your server via SSH

then connect to your mysql console

and

USE user_base
REPAIR TABLE TABLE;

-OR-

If there are a lot of broken tables in current database:

mysqlcheck -uUSER -pPASSWORD  --repair --extended user_base

If there are a lot of broken tables in a lot of databases:

mysqlcheck -uUSER -pPASSWORD  --repair --extended -A

answered Aug 21, 2014 at 23:23

Nedudi's user avatar

NedudiNedudi

5,4812 gold badges40 silver badges36 bronze badges

1

When I got this error:

#145 — Table ‘.enginephpbb3_posts’ is marked as crashed and should be repaired

I ran this command in PhpMyAdmin to fix it:

REPAIR TABLE phpbb3_posts;

Dharman's user avatar

Dharman

29.3k21 gold badges80 silver badges131 bronze badges

answered May 8, 2014 at 6:05

RasoolLotfi's user avatar

RasoolLotfiRasoolLotfi

2863 silver badges6 bronze badges

This means your MySQL table is corrupted and you need to repair it. Use

myisamchk -r /DB_NAME/wp_posts

from the command line. While you running the repair you should shut down your website temporarily so that no new connections are attempted to your database while its being repaired.

Kirk Beard's user avatar

Kirk Beard

9,38612 gold badges46 silver badges47 bronze badges

answered Dec 5, 2010 at 3:54

Dmitri's user avatar

DmitriDmitri

33.7k9 gold badges38 silver badges55 bronze badges

2

Here is simple steps.

Go to phpmyadmin and checked that table which one crushed and then select Repair table option.

enter image description here

answered Mar 10, 2021 at 5:13

Siraj Ali's user avatar

Siraj AliSiraj Ali

4783 silver badges12 bronze badges

I agree with @Nican
you can follow the given steps. It works some times. I have faced the same Error many times in my experience. It’s not easy to find the corrupted table in the MySQL database. Low disk space could be a major cause of this error.

You can use a command to repair the corrupted or crashed MySQL table.

# myisamchk -r <table name>

Note: r means recovery mode

If it does not work, You can go for a difficult repair.

Step 1 – Shift a database to a safe location.
Step 2- Create a new empty data and index file.
Step 3- Copy the old data file back onto the newly created data file

Note: You must maintain the main backup copy to recover if something goes wrong.

If both solutions do not work for you, I strongly recommend you go for a stellar repair for MySQL. This one is my best friend in my bad situations. It saves my data many times

answered Dec 21, 2022 at 7:36

Jack D's user avatar

MySQL is an open source RDBMS backed by Oracle. It supports all platforms, for example, UNIX, Windows, and Linux. It is mostly associated with web apps and online publishing, but it is not restricted to that, and can be used in a wide range of applications. Its working model is a client-based server.

The core of MySQL is MySQL server that handles all of the database commands. MySQL server is available as a separate program for use in a client-server networked environment. Though it is installed on one machine as a library that can be linked to separate applications, it is capable of sending data to multiple locations. It allows data to be stored on and accessed over multiple storage engines. To improve performance and durability, it also can replicate data. And you are not required to learn new commands for MYSQL; you can access the MySQL database by using standard SQL commands.

Crashed Tables in MySQL

While using MySQL, users may experience an error stating that “MySQL table is marked as crashed and should be repaired.” This error can appear at any time, especially after a forced shutdown of MySQL database or due to the crash of the entire server. While the error may seem daunting, it can be resolved. MySQL can repairing the crashed tables by itself. You would need to follow a few simple steps to make that happen. 

Let’s discuss the possible reasons and MySQL repair methods for this error.

The cause behind the error

Low disk space could be a reason for MySQL table being marked as “crashed”. When you have low space on your disk, some of the tables in the database may get crashed. It usually happens when you get space issues on the part of the hard disk where your database is stored.

Often it gets difficult to identify the specific tables that are affected by the error. Before starting the repair process, thus, let us quickly take a look at how to identify the corrupted MySQL tables.

Identifying crashed MySQL tables

You can identify corrupted tables through certain expected and observable errors in the queries, for example:

  • Can’t find file tbl_name.MYI (Errcode: nnn)
  • Unexpected end of file
  • Got error from table handler
  • Record file is crashed
  • Can’t find file tablethatshouldbethere.MYI
  • tablethatwasworking.frm is locked against change
  • Got error ### from table handler.

You can run perror to get more information about the error

Recovering MySQL Crashed Tables

MySQL server provides its own tool to diagnose crashed tables. This tool is known as myisamchk, and you can use it as shown below:

# myisamchk -s /var/lib/mysql/*/*.MYI

Running this command will list the crashed MySQL tables, with a message as follows:

MyISAM-table '/var/lib/mysql/dbname/table_name.MYI' is marked as crashed and should be repaired

Other than diagnosis, the tool can also help you repair the damaged table. In most cases, the problem is solved by running the myisamchk command. But if it doesn’t solve the problem, try stopping your web service, so that no new requests are generated, stop the MySQLd daemon itself and run the below-given command:

# myisamchk -r --update-state /var/lib/mysql/dbname/table_name.MYI

The “–update-state” switch tells MySQL to mark the indicated table as “checked.” Once this has been done, restart your MySQLd and web service, and MySQL will repair the crashed table. As a result, the error will be removed, and your database will be safely restored.

Recovering database by using backup

Another way to deal with ‘MySQL table is marked as crashed and should be repaired’ error is to recover your database from a previously saved backup.

Having a solid backup strategy for your data is essential. It helps you recover the data when everything else goes wrong. Instead of searching the methods for repairing MySQL crashed tables, you can restore data instantly from a backup, and that will surely save your time. That’s why your database, install directory, and home directories should be backed up and tested regularly by using database administration or any backup tool of your choice.

Software tool for MySQL Database Repair

Stellar Repair for MySQL is a powerful and convenient tool for MySQL database repair, which can save time while doing the repair more effectively. So, it can be your default first choice.

Alternatively, you can use the software as a complementary solution to fill in for the manual method- if it doesn’t work, or if you don’t have the backup to restore your database.

It is available for a free trial download so that you can test it out for repairing your MySQL database files. The software recovers all the objects including keys, views, triggers, tables, etc., in their original format. It can repair InnoDB and MyISAM tables and allows us to save the MySQL repair database in various formats like MySQL, CSV, HTML, and XLS.

Free Download for Windows

To summarize

MySQL is one of the most trusted relational database management systems. But if you need to write queries in MySQL repair table or recover tables, you need to have deep technical knowledge about it. You cannot play around with MySQL without knowing the roots of it since that will increase the chances of you losing the data permanently.

So, if you don’t have hands-on proficiency on MySQL, a safer option is to recover the corrupt database by using the backup. Next, you can use the built-in myisamchk utilityfor the database repair.

A safer, convenient, and more effective MySQL database repair solution is offered by Stellar Repair for MySQL. It’s available for the free trial which offers to scan and preview the database so that you can ascertain the capabilities really well.

About The Author

Priyanka

Priyanka is a technology expert working for key technology domains that revolve around Data Recovery and related software’s. She got expertise on related subjects like SQL Database, Access Database, QuickBooks, and Microsoft Excel. Loves to write on different technology and data recovery subjects on regular basis. Technology freak who always found exploring neo-tech subjects, when not writing, research is something that keeps her going in life.

Best Selling Products

Stellar Data Recovery Professional for Windows

Stellar Data Recovery Professional for Windows

Stellar Data Recovery has the right Windows Recovery tool for all your data recovery

Read More

Stellar Data Recovery Professional for Mac

Stellar Data Recovery Professional for Mac

Stellar Data Recovery for Mac program performs safe..

Read More

Stellar Photo Recovery

Stellar Photo Recovery

A comprehensive photo recovery software to restore photos, music & video files

Read More

Stellar Repair for Video

Stellar Repair for Video

Powerful video repair tool for repairing corrupt or damaged MOV and other video files

Read More

Содержание

  1. Ошибка Table ‘tablename’ is marked as crashed and should be repaired
  2. Способ 1: с использованием PHPMyAdmin
  3. Способ 2: с использованием MySQL Client Software (MySQL CLI)
  4. Fix: MySQL table is marked as crashed and last repair failed
  5. Solution One – Repair table using myisamchk command
  6. Solution Two – Find and Fix broken tables
  7. Solution Three – Different ways to repair corrupt tables
  8. What to do if none of these solutions work?
  9. About The Author
  10. Best Selling Products
  11. Stellar Data Recovery Professional for Windows
  12. Stellar Data Recovery Professional for Mac
  13. Stellar Photo Recovery
  14. Stellar Repair for Video
  15. [Fix] MySQL is marked as crashed and should be repaired
  16. Crashed Tables in MySQL
  17. The cause behind the error
  18. Identifying crashed MySQL tables
  19. About The Author
  20. Best Selling Products
  21. Stellar Data Recovery Professional for Windows
  22. Stellar Data Recovery Professional for Mac
  23. Stellar Photo Recovery
  24. Stellar Repair for Video

Ошибка Table ‘tablename’ is marked as crashed and should be repaired

Эта ошибка может появляться в mysql, например, после непредвиденного отключения питания у сервера, неожиданного завершения работы самого MySQL сервера или каких-либо ошибках в работе диска.

Error Number: 145
The Error returned was:
Table ‘tablename’ is marked as crashed and should be repaired

Как и следует из текста ошибки, нам необходимо просто отремонтировать поврежденную таблицу с помощью встроенных средств MySQL. В данной статье будет описано 2 способа, как это сделать.

Способ 1: с использованием PHPMyAdmin

Открываем перечень всех таблиц в PHPMyAdmin, после чего выделяем нужную и выбираем пункт «Repair table».

Способ 2: с использованием MySQL Client Software (MySQL CLI)

Сначала выбираем необходимую базу данных (в примере ниже это MYDATABASE):

А далее уже ремонтируем саму поврежденную таблицу (в примере ниже это m_rating) в выбранной базе данных, для этого нужно отправить следующую команду:

Источник

Fix: MySQL table is marked as crashed and last repair failed

If you are using MySQL Command-line client to query your database, you may come across an error which says:

“MySQL Table is marked as crashed and last (automatic?) Repair failed”.

The error can be caused due to many reasons including zero disk space available on the server, a hard reset of server, forced shutdown of MySQL, or MySQL process crashing due to some reason.

There are different ways to resolve this error and the right method depends on its root cause. First, we will discuss a common solution that can be used in several cases.

Solution One – Repair table using myisamchk command

  1. Login in your server using SSH command like – ssh root@example.com
  2. Stop the MySQL daemon/service by executing the command- service mysql stop
  3. Change directory to your MySQL database. The directory is usually located in /var/lib/mysql. The command to use is cd /var/lib/mysql/YOUR_DATABASE_NAME
  4. Now, you have to simply run the myisamchk command by executing – myisamchk -r table_name

Note – In the above step you have to replace the actual table name with “table name”. The output of the command will mention the recovery of the table and also fix any corrupt records.

  1. Start the MySQL service
    again by executing command – service mysql start

The MySQL table problem would be resolved now and you can query tables in the database through MySQL CLI.

Solution Two – Find and Fix broken tables

If you are getting this error, it indicates one or more tables in the database are corrupt and need to be fixed. The first step in this solution is to find the tables that are the cause of the error. Here are the steps to follow.

To find the table marked as crashed and needs to be repaired, execute these commands

  1. # myisamchk -s /var/lib/mysql/*/*.MYI
  2. MyISAM-table ‘/var/lib/mysql/dbname/table_name.MYI’ is marked as crashed and should be repaired

The above command will list all tables that are marked as crashed and need to be repaired

  1. To repair the table, execute the following command – # myisamchk -r /var/lib/mysql/dbname/table_name.MYI

You need to execute this command for every table that is marked as crashed and needs to be repaired. Every time the value of table_name would be different.

  1. The above solution will resolve the error. If it doesn’t you need to stop the Stop the MySQL daemon/service by executing the command- service mysql stop

After the MySQL web service is stopped you need to update the state of the tables so that MySQL CLI knows the corrupt tables have been checked and repaired. Execute the command given below to update the state of the table.

  1. myisamchk -r –update-state /var/lib/mysql/dbname/table_name.MYI

After you have updated the state of every repaired table, you need to restart the MySQL service. Execute the command given below to start the MySQL service.

Solution Three – Different ways to repair corrupt tables

As discussed in the earlier solution, the easiest way to resolve the error is repairing the corrupt tables. While we have discussed one way to find and repair corrupt tables, there are alternative ways too that you would like to know. Here we have discussed different ways to find and repair corrupt tables.

Stage One – Check Tables

Run myisamchk *.MYI or myisamchk -e *.MYI. You can also use the silent option to suppress unnecessary information. The command syntax is myisamchk –silent *.MYI

Some of the symptoms of the corrupted table manifest as queries that are aborted unexpectedly, and you get errors such as :

  • Unexpected end of file
  • Can’t find file tbl_name.MYI (Errcode: nnn)
  • Record file is crashed
  • Got error nnn from table handler
  • tbl_name.frm is locked against change

To get more information about the error, use the run perror nnn, where nnn is the error number.

Stage Two – Easy Safe Repair

After you have found tables that are corrupt, you need to try the command

  1. Use myisamchk -r -q tbl_name

Here the -r -q means “quick recovery mode. This command will attempt to repair the index file of the table without touching the data file. If the table is not repaired due to some reason, execute the commands given below.

  1. Create a backup of the data file before proceeding
  2. Use myisamchk -r tbl_name. Here -r means “recovery mode”. The command removes incorrect rows and deleted rows from the data file and reconstructs the index file. If this step fails, execute the command below
  3. Use myisamchk –safe-recover tbl_name. This is an old recovery method used in specific cases where the normal recovery mode fails

Since the Safe Recovery mode is slow, you need to be patient while data recovery happens. To speed up the recovery process, set the values of key_buffer_size and the sort_buffer_size variables each to about 25% of your available memory when running myisamchk.

Stage 3 – Difficult repair

Not all tables’ recovery is simple. In many cases, the index file is missing or first 16KB block in the index file is destroyed or contains incorrect information. These are categorized as difficult repair and need a different approach.

To resolve such cases, you need to create a new index file. Here are the steps to follow.

  1. Move data file to a safe place
  2. Create new empty data file and index file using the commands given below
    • mysql db_name
    • SET autocommit=1;
    • TRUNCATE TABLE tbl_name;
    • Quit
  3. Copy the old data file into the newly created data file.
  4. Now go back to Stage 2 and execute the commands and they should work to recover tables.

What to do if none of these solutions work?

If you’re unable to resolve the error by using the above-mentioned methods, do not despair. You can use an automated solution to the problem. Stellar Repair for MySQL is a worthwhile and reliable solution to the “MySQL table is marked as crashed and last repair failed” error.

The software can remove tough errors from MySQL and make the data available for restoration. It has several striking features and an interactive GUI, which makes it easy for operation. If all the available manual methods have failed, you can place your trust in this software without hesitation.

Conclusion

We hope the above solutions will work to repair corrupt tables and fix the problem in the database. After you have repaired corrupt tables, the MySQL command-line client should be able to query the database and get the required results.

Priyanka is a technology expert working for key technology domains that revolve around Data Recovery and related software’s. She got expertise on related subjects like SQL Database, Access Database, QuickBooks, and Microsoft Excel. Loves to write on different technology and data recovery subjects on regular basis. Technology freak who always found exploring neo-tech subjects, when not writing, research is something that keeps her going in life.

Best Selling Products

Stellar Data Recovery Professional for Windows

Stellar Data Recovery has the right Windows Recovery tool for all your data recovery

Stellar Data Recovery Professional for Mac

Stellar Data Recovery for Mac program performs safe..

Stellar Photo Recovery

A comprehensive photo recovery software to restore photos, music & video files

Stellar Repair for Video

Powerful video repair tool for repairing corrupt or damaged MOV and other video files

Источник

[Fix] MySQL is marked as crashed and should be repaired

MySQL is an open source RDBMS backed by Oracle. It supports all platforms, for example, UNIX, Windows, and Linux. It is mostly associated with web apps and online publishing, but it is not restricted to that, and can be used in a wide range of applications. Its working model is a client-based server.

The core of MySQL is MySQL server that handles all of the database commands. MySQL server is available as a separate program for use in a client-server networked environment. Though it is installed on one machine as a library that can be linked to separate applications, it is capable of sending data to multiple locations. It allows data to be stored on and accessed over multiple storage engines. To improve performance and durability, it also can replicate data. And you are not required to learn new commands for MYSQL; you can access the MySQL database by using standard SQL commands.

Crashed Tables in MySQL

While using MySQL, users may experience an error stating that “MySQL table is marked as crashed and should be repaired.” This error can appear at any time, especially after a forced shutdown of MySQL database or due to the crash of the entire server. While the error may seem daunting, it can be resolved. MySQL can repairing the crashed tables by itself. You would need to follow a few simple steps to make that happen.

Let’s discuss the possible reasons and MySQL repair methods for this error.

The cause behind the error

Low disk space could be a reason for MySQL table being marked as “crashed”. When you have low space on your disk, some of the tables in the database may get crashed. It usually happens when you get space issues on the part of the hard disk where your database is stored.

Often it gets difficult to identify the specific tables that are affected by the error. Before starting the repair process, thus, let us quickly take a look at how to identify the corrupted MySQL tables.

Identifying crashed MySQL tables

You can identify corrupted tables through certain expected and observable errors in the queries, for example:

  • Can’t find file tbl_name.MYI (Errcode: nnn)
  • Unexpected end of file
  • Got error from table handler
  • Record file is crashed
  • Can’t find file tablethatshouldbethere.MYI
  • tablethatwasworking.frm is locked against change
  • Got error ### from table handler.

You can run perror to get more information about the error

Recovering MySQL Crashed Tables

MySQL server provides its own tool to diagnose crashed tables. This tool is known as myisamchk, and you can use it as shown below:

Running this command will list the crashed MySQL tables, with a message as follows:

Other than diagnosis, the tool can also help you repair the damaged table. In most cases, the problem is solved by running the myisamchk command. But if it doesn’t solve the problem, try stopping your web service, so that no new requests are generated, stop the MySQLd daemon itself and run the below-given command:

The “–update-state” switch tells MySQL to mark the indicated table as “checked.” Once this has been done, restart your MySQLd and web service, and MySQL will repair the crashed table. As a result, the error will be removed, and your database will be safely restored.

Recovering database by using backup

Another way to deal with ‘MySQL table is marked as crashed and should be repaired’ error is to recover your database from a previously saved backup.

Having a solid backup strategy for your data is essential. It helps you recover the data when everything else goes wrong. Instead of searching the methods for repairing MySQL crashed tables, you can restore data instantly from a backup, and that will surely save your time. That’s why your database, install directory, and home directories should be backed up and tested regularly by using database administration or any backup tool of your choice.

Software tool for MySQL Database Repair

Stellar Repair for MySQL is a powerful and convenient tool for MySQL database repair, which can save time while doing the repair more effectively. So, it can be your default first choice.

Alternatively, you can use the software as a complementary solution to fill in for the manual method- if it doesn’t work, or if you don’t have the backup to restore your database.

It is available for a free trial download so that you can test it out for repairing your MySQL database files. The software recovers all the objects including keys, views, triggers, tables, etc., in their original format. It can repair InnoDB and MyISAM tables and allows us to save the MySQL repair database in various formats like MySQL, CSV, HTML, and XLS.

To summarize

MySQL is one of the most trusted relational database management systems. But if you need to write queries in MySQL repair table or recover tables, you need to have deep technical knowledge about it. You cannot play around with MySQL without knowing the roots of it since that will increase the chances of you losing the data permanently.

So, if you don’t have hands-on proficiency on MySQL, a safer option is to recover the corrupt database by using the backup. Next, you can use the built-in myisamchk utilityfor the database repair.

A safer, convenient, and more effective MySQL database repair solution is offered by Stellar Repair for MySQL. It’s available for the free trial which offers to scan and preview the database so that you can ascertain the capabilities really well.

About The Author

Priyanka is a technology expert working for key technology domains that revolve around Data Recovery and related software’s. She got expertise on related subjects like SQL Database, Access Database, QuickBooks, and Microsoft Excel. Loves to write on different technology and data recovery subjects on regular basis. Technology freak who always found exploring neo-tech subjects, when not writing, research is something that keeps her going in life.

Best Selling Products

Stellar Data Recovery Professional for Windows

Stellar Data Recovery has the right Windows Recovery tool for all your data recovery

Stellar Data Recovery Professional for Mac

Stellar Data Recovery for Mac program performs safe..

Stellar Photo Recovery

A comprehensive photo recovery software to restore photos, music & video files

Stellar Repair for Video

Powerful video repair tool for repairing corrupt or damaged MOV and other video files

Источник


Windows

  • 21.04.2017
  • 13 539
  • 2
  • 17
  • 17
  • 0

Ошибка Table 'tablename' is marked as crashed and should be repaired

  • Содержание статьи
    • Способ 1: с использованием PHPMyAdmin
    • Способ 2: с использованием MySQL Client Software (MySQL CLI)
    • Комментарии к статье ( 2 шт )
    • Добавить комментарий

Эта ошибка может появляться в mysql, например, после непредвиденного отключения питания у сервера, неожиданного завершения работы самого MySQL сервера или каких-либо ошибках в работе диска.

Error Number: 145
The Error returned was:
Table ‘tablename’ is marked as crashed and should be repaired

Как и следует из текста ошибки, нам необходимо просто отремонтировать поврежденную таблицу с помощью встроенных средств MySQL. В данной статье будет описано 2 способа, как это сделать.

Способ 1: с использованием PHPMyAdmin

Открываем перечень всех таблиц в PHPMyAdmin, после чего выделяем нужную и выбираем пункт «Repair table».

Способ 2: с использованием MySQL Client Software (MySQL CLI)

Сначала выбираем необходимую базу данных (в примере ниже это MYDATABASE):

mysql> USE MYDATABASE;
Database changed

А далее уже ремонтируем саму поврежденную таблицу (в примере ниже это m_rating) в выбранной базе данных, для этого нужно отправить следующую команду:

mysql> REPAIR TABLE m_rating;

В логах mysql сервера были обнаружены записи:

170216 16:03:18 [ERROR] /usr/sbin/mysqld: Table './mydb/j17_content' is marked as crashed and should be repaired
170216 16:03:18 [Warning] Checking table:   './mydb/j17_content'
170216 16:03:18 [ERROR] /usr/sbin/mysqld: Table './mydb/j17_redirect_links' is marked as crashed and should be repaired
170216 16:03:18 [Warning] Checking table:   './mydb/j17_redirect_links'
170216 16:03:18 [ERROR] /usr/sbin/mysqld: Table './mydb/j17_session' is marked as crashed and should be repaired
170216 16:03:18 [Warning] Checking table:   './mydb/j17_session'

аналогично этим ошибкам, могут быть:

126 = Index file is crashed / Wrong file format
127 = Record-file is crashed
132 = Old database file
134 = Record was already deleted (or record file crashed)
135 = No more room in record file
136 = No more room in index file
141 = Duplicate unique key or constraint on write or update
144 = Table is crashed and last repair failed
145 = Table was marked as crashed and should be repaired

Таблицы MyISAM, требуется восстановление.
Останавливаем mysql и делаем бекап каталогов необходимых баз из /var/lib/mysql, далее запускаем, если востановка по 2 способу.

1 способ с остановкой mysqld

Останавливаем сервис mysqld!

Переходим в каталог с файлами таблицы /var/lib/mysql/mydb/
Ищем ошибки:

# myisamchk -s *.MYI
MyISAM-table '/var/lib/mysql/mydb/table_name.MYI' is marked as crashed and should be repaired

Проверка таблиц:

myisamchk --update-state -e *.MYI

Если mysqld остановлен, то следует использовать опцию --update-state для указания myisamchk отмечать таблицы как ‘проверенные'(checked).

Восстанавливаем:

myisamchk -r -q j_content
myisamchk -r -q j_redirect_links
myisamchk -r -q j_session

-r -q означает «режим быстрого восстановления»
-r означает «режим восстановления»

2 способ без остановки mysqld

Если crashed всего несколько таблиц, то можно выполнить repair table из консольного mysql клиента или phpmyadmin при помощи sql запроса:

USE user_base;
REPAIR TABLE TableName;

Если в базе crashed много таблиц, то будет проще выполнить команду:

mysqlcheck -uUSER -pPASSWORD  --repair --extended user_base

ну а если много побитых таблиц, да еще и в большом количестве баз, то восстановление лучше запустить на все базы, командой:

mysqlcheck -uUSER -pPASSWORD  --repair --extended -A

Оптимизация и ремонт всех таблиц во всех базах данных
Следующая команда будет проверять все таблицы во всех базах данных, и если какая-то таблица повреждена он автоматически исправит это эту таблицу:

mysqlcheck --auto-repair -o --all-databases

http://www.mysql.ru/docs/man/myisamchk_syntax.html
http://www.mysql.ru/docs/man/Repair.html
http://www.mysql.ru/docs/man/Using_mysqlcheck.html
http://itblog.su/table-is-marked-as-crashed-and-should-be-repaired.html
https://andreyex.ru/blog-platforma-wordpress/luchshie-uchebniki-po-wordpress/optimizaciya-i-vosstanovlenie-baz-dannyx-mysql-s-pomoshhyu-mysqlcheck/

Mysql Table Is Marked As Crashed And Should Be Repaired

Are you facing “MySQL is marked as crashed and should be repaired” error message while accessing your MySQL database? Tried several ways to solve this issue but still not get success? If ‘YES’ then you have come to very correct place.  As in this article, you’ll learn how to fix table ‘./mysql/proc’ is marked as crashed and should be repaired error.

But before knowing the fixes to deal with such error, it’s very important to know about this issue and what causes this MySQL is marked as crashed error. So, without wasting any more time, read ahead…

“MySQL is marked as crashed and should be repaired”

MySQL is marked as crashed and should be repaired

The above mentioned error message may occur while you’re trying to accessing the MySQL database. The frequency of this error is more after the forced shutdown of MySQL database or because of the crash in the entire server. Now, let’s see what actually causes this issue.

What Causes MySQL Is Marked As Crashed Issue?

There are varuoius reason that causes of table mysql/proc’ is marked as crashed and should be repaired error. The first reason is behind the table crash is running out of disk space. If you got the huge amount of data in your database then ensure that you got the required disk space in advance.

Other reason behind MySQL table crashes are issuers with the operating system, hardware problems, power failures, unexpected termination of MySQL server, data corruption due to external programs.

Before proceeding towards a repair process, let have a look at how to identify a damaged or corrupted MySQL tables.

Identifying The Crashed MySQL Tables

Well, you can easily the corrupted or damaged MySQL tables via some observable errors which I have listed below:

  1. Unexpected end of the file
  2. Cannot find file tbl_name.MYI (Errcode: nnn)
  3. Recorded file is crashed
  4. Got error from table handler
  5. frm is locked against change
  6. Can’t find file tablethatshouldbethere.MYI
  7. Got error ### from table handler.

How Long It Will Take To Repair The Crashed MySQL Table?

This is the question of most of the users for the few KB table, it just take a few seconds; for few MB table, it take few minutes; for few GB table it take hours; for huge GB tables, it take days to weeks! It even depends on the available RAM and the processor power.

Do you got the backup of the table? It might be the better option to restore the table from the backup before fixing any error. Generally, user face crash issue and the best option to overcome it to use the backup.  Unless the data is very important and you need it urgently run a weeklong repair process. But isn’t the weeklong repair process quite time consuming. Think about it. Always have a proper backup of your database.

How To Fix MySQL Table Is Marked As Crashed And Should Be Repaired” Error?

To repair the MySQL repair crashed table command line by following the given methods:

  • Technique #1: Use The Myisamchk To Fix MySQL Table Is Marked As Crashed
  • Technique #2: Repairing Table Using MySQL console
  • Technique #3: Using PHPMyAdmin

Technique #1: Use The Myisamchk To Fix MySQL Table Is Marked As Crashed

The first method that you can to try to deal with the table ‘./MySQL/proc’ is marked as crashed and should be repaired error is to use MYISAMCHK tool.

To fix using myisamchk, you need to follow the below given steps:

Step 1: Firstly, Login to the server by using SSH command like–ssh root@example.com.

Step 2: Then, stop MySQL daemon/service through executing a MySQL stop command service directory to your MySQL database.

Step 3: Generally the directory is in /var / lib / mysql. And the command to try the below commend:

cd / var /lib / MySQL/YOUR DATABASE NAME

Step 4: At this time, execute a myisamchk command that mentioned below:

myisamchk-r table name.

Step 5: Now, start the MySQL service again via executing a MySQL command.

After completion of these steps, you can see that your MySQL table error has been fixed. If this method unable to fix the above mentioned error then you can try the next solution.

Technique #2: Repairing Table Using MySQL console

If got the shell access then connect to MySQL server and perfrom the following steps:

>use my_database;
>repair table my_crashed_table;

This step is recommended to repair crashed tables from few KBs to few GBs, which depend on the RAM and processor power.

Technique #3: Using PHPMyAdmin

Rememeber: if you haven’t got the shell access then only use this method. Usually this step is recommended for small size tables only, few KB to few MBs. And anything more than that will only be a waste of time and you’ll end up frustrated. Perform the following steps:

Log on PHPMyAdmin > choose affected database > choose affected table from right pane > from With selected menu, choose “Repair table”.

The crashed table will be repaired in short span of time, if the table size is a few KBs to a few MBS, and engine is MyISAM.

Automatic Way to Solve MySQL Table Is Marked As Crashed And Should Be Repaired” Error

If the above given solutions fails to table mysql/proc’ is marked as crashed and should be repaired then another best option left for you that is MySQL Repair Tool. Yes, it is an amazing tool, which help you repair corrupted, damaged or inaccessible data.

It not only repairs the corrypted MySQL database but also recovers data and tables structure in a healthy form. With the help of this software there is no chance of losing your important data. It supports almost every versions of MySQL such as 1.x, 2.x, 4.x, 5.x or 3.x which is accessible for all present platforms that include Windows 98/ 95/XP/200/2003 servers.

It has user friendly interface which doesn’t require any technical knowledge to fix any type of error and issues in the MySQL file. So without wasting time download this feature loaded software.

Steps To Resolve “Table For Sessions Is Marked As Crashed And Should Be Repaired” Error

Step 1: Start with Stellar Phoenix Database Repair for MySQL . Software and you can see the main interface as shown below.1

Step 2: Click on ‘Select’ button & then select ‘Repair corrupt database which is stored at default location of MySQL’ option to select your database from default location and then click.2

Step 3: The left pane shows the preview of database and its component in a tree like structure after completing scanning process.3

Step 4: After previewing your database, to start repair process click ‘Repair’ button in file menu on the main user interface. Stellar Phoenix Database Repair for MySQL dialog box appears. Click Yes.

4

Step 5: After successful completion of the process, a message box is displayed as ‘repair process finished successfully’. Click ‘OK’ to close the message box.5

Step 6: If you want to select the database manually then select ‘Manual selection of database to repair’ option & then click browse. Browse the folder dialog box opens. Select the folder that contains database and click ‘OK’.

To Sum Up

Well, I hope all the above given solutions will definitely work for you to repair MySQL table is marked as crashed and should be repaired issue. But, if you want the instant MySQL repair crashed table resolution, then I would like to suggest you to try the best and advanced MySQL Repair Tool to fix this issue.

If you liked this post then do not forget to share it with you friends & family members.

Jacob Martin is a technology enthusiast having experience of more than 4 years with great interest in database administration. He is expertise in related subjects like SQL database, Access, Oracle & others. Jacob has Master of Science (M.S) degree from the University of Dallas. He loves to write and provide solutions to people on database repair. Apart from this, he also loves to visit different countries in free time.


Megha Sharma

Read time 4 minutes

MySQL is an open-source Relational Database Management System (RDBMS), which is written in C and C++ languages and supports multiple platforms including Windows, Linux, macOS, UnixWare, etc. It is used by various applications for data storage, online publishing, and web apps. Also, it is supported by Oracle.

It works based on the client-server model with MySQL Server as the server. You can store, access, or retrieve the data stored in the server anytime.

In this blog, we get a brief introduction to one of the common MySql errors- MySql is marked as crashed and should be repaired.

Table ‘./dbname/table_name’ is marked as crashed and should be repaired

The MySQL error “MySQL is marked as crashed and should be repaired” may occur suddenly while you are accessing MySQL. The frequency of the error is more after the forced shutdowns of the MySQL Server. Whatever be the reason, you cannot access or use your MySQL tables anymore as it has been completely crashed.

Reasons for the “MySQL is marked as crashed and should be repaired” error

While using MySQL, users sometimes face issues with the pop-up message, such as “MySql table is marked as crashed and should be repaired” and this happens especially after an abrupt system shutdown. Less disk capacity is the reason behind MySQL tables being marked as crashed because due to less space, tables in the database might get damaged. Other reasons like high I/O wait on the disk, and heavy load on the server can also cause MySQL crashes.

How one can identify MySQL crashes?

One can identify this problem by certain error messages, which are as follows-

  • “Unexpected end of file”
  • “Record file is crashed”
  • “Can’t find file tbl_name.MYI (Errcode: nnn)”
  • “tablethatwasworking.frm is locked against change”
  • “Got error ### from table handler”

What is the Immediate Remedy? – Restore from Backups

If you are a professional or a common MySQL Server user, you must have taken backups of the MySQL Server database files. With a recent backup of MySQL Server, it would be quite easy to restore the whole database. But If you do not have backups for MySQL Server data, then you will have to find some other solutions on your own, which would take both effort and time. So, our suggestion is to take periodic backups of the MySQL database.

How to Fix Error “MySQL is marked as crashed and should be repaired” Without Backups?

Through myisamchk Tool

Users can find out the broken or crashed MySQL tables using the native tool provided by the MySQL application known as “myisamchk”.

Run this command on myisamchk command line.

# myisamchk -s /var/lib/mysql/*/*.MYI

It will list out the tables which are corrupted, and you would get to know where to make the fix.

Once you get to know the name of the tables that need repair, then you can execute the next command.

# myisamchk -r /var/lib/mysql/dbname/table_name.MYI

In the above command, you need to provide the table name which was found out in the first command (broken or crashed).

If the table is not repaired yet, you can try another command. Before that, just stop the web services, stop MySQLd and then run this command.

# myisamchk -r –update-state /var/lib/mysql/dbname/table_name.MYI

Next, restart the MySQLd and the web services and check if the error is fixed.

Even after executing these commands in myisamchk application, it might be possible that you get an incomplete recovery or no recovery at all. But we are here to help you.

What Should Be Your Next Step? – Professional Third-Party Utility

If you want to recover the corrupt MySQL Server database completely and flawlessly, then you should go for the professional third-party utility which is reliable and efficient.

Here, we introduce you to the advanced Kernel for MySQL Database Repair tool for MySQL file recovery in very little time. It is designed with the latest technology and highly efficient programs to quickly fix all the corruption issues of MySQL database files and make the data accessible to the users.

It effectively repairs all the issues of the MySQL file and makes the inaccessible data available for preview. Now, you can select the required data and then save it to either MySQL Server directly or to a batch file. Moreover, the advanced tool is compatible with all MySQL Server and Windows Operating System versions.

Final Words

MySQL database is popular among database users as it is open-source and is supported by Oracle. However, there are a few errors that make its data inaccessible. Here, we have discussed some manual solutions to fix one of the MySQL errors. And in case of an unsuccessful repair, we have suggested a professional tool at the end.

Stuck with mysqldump error 1194 table is marked as crashed? We can help you.

Generally, we come across the error, “MySQL table is marked as crashed and should be repaired” while using MySQL.

This error appears especially after a forced shutdown of the MySQL database or due to the crash of the entire server.

As part of our Server Management Services, we assist our customers with several MySQL queries.

Today, let’s discuss the possible reasons and MySQL repair methods for this error.

mysqldump error 1194 table is marked as crashed

Mostly, low disk space can be a reason for the error. In case we have low disk space, some of the tables in the database may rash.

Usually, this happens when we get space issues on the hard drive where the database is stored.

Though the error seems daunting, we can resolve it. MySQL can repair the crashed tables by itself.

In order to make that happen, our Support Techs suggest a few simple steps.

Quite often, it is hard to identify the specific tables affected by the error. Hence, before the repair, let us have a look at how to identify the corrupted MySQL tables.

Identify crashed MySQL tables

We can identify the corrupt tables through certain expected and observable errors in the queries.

For example,

  • Can’t find file tbl_name.MYI (Errcode: nnn)
  • Unexpected end of file
  • Got error from table handler
  • Record file crash
  • Can’t find the file, tablethatshouldbethere.MYI
  • tablethatwasworking.frm locks against change
  • Got error ### from table handler.

In addition, we can run perror to get more information about the error

Recover MySQL Crashed Tables

MySQL server provides its own tool, myisamchk to diagnose crashed tables.

# myisamchk -s /var/lib/mysql/*/*.MYI

This command will list the crashed MySQL tables, with a message:

MyISAM-table '/var/lib/mysql/dbname/table_name.MYI' is marked as crashed and should be repaired

In addition, the tool can help repair the damaged table. Generally, if we run the myisamchk command it should solve the problem.

However, if it doesn’t, we try to stop the web service, so as to not generate new requests. we stop the MySQLd daemon itself and run:

# myisamchk -r --update-state /var/lib/mysql/dbname/table_name.MYI

The “–update-state” switch tells MySQL to mark the indicated table as “checked.”

Once done, we restart the MySQLd and web service, and MySQL will repair the crashed table.

This will remove the error and restore the database.

Recover database by using backup

On the other hand, an alternative to deal with the error is to recover the database from a previous backup.

A solid backup strategy for the data is essential. When everything goes wrong, instead of searching for the methods to repair, we can look up to it.

So, we need to take regular backup of the database, install directory, and home directories by using database administration or any backup tool.

[Need help to recover? We’d be happy to assist]

Conclusion

In short, here we saw how our Support Techs fix the mysqldump error 1194 for our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

You may experience crashed MyISAM tables in MySQL from times to times, especially after a forced shutdown (kill -9) of MySQL or a crash of the entire server.

The errors will look like this in your logs. InnoDB has good crash recovery on its own and will probably never give you these errors as it self-repairs upon MySQL restart.

[ERROR] /usr/libexec/mysqld: Table './dbname/table_name' is marked as crashed and should be repaired
[ERROR] /usr/libexec/mysqld: Table './dbname/table_name' is marked as crashed and should be repaired
[ERROR] /usr/libexec/mysqld: Table './dbname/table_name' is marked as crashed and should be repaired

You can also find broken tables with the

myisamchk tool that is provided by the MySQL server installation.

# myisamchk -s /var/lib/mysql/*/*.MYI
MyISAM-table '/var/lib/mysql/dbname/table_name.MYI' is marked as crashed and should be repaired

The above command will show you each table that is in need of repair.

If a table is reported as damaged, repair it with that same tool.

# myisamchk -r /var/lib/mysql/dbname/table_name.MYI

That solves the problem in most cases. If it doesn’t, make sure to stop your webservice (so no new MySQL requests are being made), stop the MySQLd daemon itself and run the following command.

# myisamchk -r --update-state /var/lib/mysql/dbname/table_name.MYI

The --update-state tells MySQL to mark the table as “checked”. Restart your MySQLd and webservice and you should be good go to.

If you’re up for more mild reading, have a look at the good documentation of MySQL itself on MyISAM repairs.

Понравилась статья? Поделить с друзьями:
  • Error mysqld got signal 11
  • Error mysql shutdown unexpectedly ошибка
  • Error mysql shutdown unexpectedly xampp как исправить
  • Error mysql server pid file could not be found
  • Error mysql error number 2003