Mysql/MariaDB: Difference between revisions

From Andreida
(Created page with "=== check/fix errors in a mysql/mariaDb database === * use the tool [https://mariadb.com/kb/en/mariadb-check/ 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")
 
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
mariadb-check --all-databases --check --password
mariadb-check --all-databases --check --password
mariadb-check --all-databases --repair --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

Latest revision as of 23:41, 24 January 2025

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