

To see the encoding of a column in a specific table, you can do this: SELECT character_set_name FROM information_schema.`COLUMNS` SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "test_db2" Let’s also look at the encoding of both databases: SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "test_db1" Id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,Ĭreate a test table in the second database and see its encoding: USE test_db2 Here is an example of changing the MySQL encoding of a database and tables.īefore any actions on important data it is necessary to make a backup copy, for example: mysqldump -u USER -h localhost -p BASE | gzip -c > backup_base_`date +%Y-%m-%d`.sql.gzįor the test, we will connect to MySQL and create a couple of new databases without specifying the encoding and specifying: mysql -u root -pĬREATE DATABASE test_db2 CHARACTER SET utf8 COLLATE utf8_general_ci Ĭreate a test table in the first database and see its encoding: USE test_db1 Posted by Vyacheslav Posted in MySQL Leave a comment on How to fix error “Table ‘name’ is marked as crashed and last (automatic?) repair failed” Installing phpIPAM

Similarly, on the test, also to speed up the process, the table was restored by copying it to another more powerful server, namely three files /var/lib/mysql/$DATABASE_NAME/ ($TABLE_NAME.MYD, $TABLE_NAME.MYI, $TABLE_m). Upon completion, if you stopped the MySQL server, then run it: sudo service mysql start Let’s move to the directory with the database: cd /var/lib/mysql/$DATABASE_NAMEĮxecute the command to restore the specified table: myisamchk -r -o -f -v $TABLE_NAME To restore the database, you must stop the MySQL server (if the table is not used, then you can not stop it): sudo service mysql stop #144 – Table ‘name’ is marked as crashed and last (automatic?) repair failed I applied to it SQL query to clean up old rows before the date specified in the query and rebooted at that moment MySQL, the request was interrupted, the database was left intact, executed the request to optimize the database and again rebooted MySQL, eventually got a corrupted database and a similar error: You can clean up via phpMyAdmin or SQL query: truncate table TableNameĪ bit later for the experiment I decided to break the whole database, took another large table in general from another application, about 8 gigabytes in size and 80 million lines. Table ‘./radius/radacct’ is marked as crashed and last (automatic?) repair failedĪs it turned out, the radacct table was damaged, since the data there were not particularly important, then the entire table was cleaned.

Once in the FreeRADIUS logs I noticed a MySQL error:
