Mysql/MariaDB

From Andreida

check/fix errors in a mysql/mariaDb database

  • use the tool mariadb-check
    • it should be installed by default if you have an installed mariadb
mariadb-check --all-databases --check --password
mariadb-check --all-databases --repair --password

start mysql command line

mysql -p

show databases

show databases;

show engines

show engines;

show engine per table

If you know your database names, you can look for the tables in the databases and their engines:

select table_name, table_schema, engine from information_schema.tables where table_schema like "YOURDATABASE%";

Use '%' instead of '*' if you want a wildcard.

select table_name, table_schema, engine from information_schema.tables where table_schema like "YOURDATABASE%" and not engine="InnoDB";


Try to fix isam files/tables

mysqladmin shutdown -p
locate *.MYI
cd /your/database/dir
myisamchk *.MYI
myisamchk -r -q <table_with_problems>
myisamchk -r -q searchindex