en:server:services:mariadb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:server:services:mariadb [2022/06/03 23:34] – [Check/update database] added --skip-version-check for mysql_upgrade danen:server:services:mariadb [2023/02/14 21:42] (current) – [Check/update database] switched to mariadb-* instead of mysql* dan
Line 101: Line 101:
 ===== Backup database ===== ===== Backup database =====
  
-You can dump all databases with the following command ''mysqldump --single-transaction --flush-logs --master-data=2 --all-databases -u root -p | gzip > all_databases.sql.gz +You can dump all databases with the following command ''mysqldump -u root -p %%--%%all-databases | gzip > all_databases.sql.gz'' or just one single database ''mysqldump -u root -p --databases database_name | gzip > database_name.sql.gz''.
-''.+
  
 Or use the following script, which contains: Or use the following script, which contains:
Line 186: Line 185:
 Upon a major version release of mariadb (for example mariadb-10.7.4-1 to mariadb-10.8.3-1), it is wise to upgrade databases:  Upon a major version release of mariadb (for example mariadb-10.7.4-1 to mariadb-10.8.3-1), it is wise to upgrade databases: 
  
-  - keep the 10.7.4-1 database daemon running +  - upgrade the package(s) 
-  - upgrade the package +  - restart the daemon 
-  - run mysql_upgrade (from the new package version) against the old still-running daemon. This will produce some error messages; however, the upgrade will succeed. +  - run mariadb-upgrade
-  - restart the daemon, so the 10.8.3 daemon runs.+
  
 <code> <code>
-mysql_upgrade -u root -p --skip-version-check +systemctl restart mariadb.service 
-</code> +</code> 
 + 
 +<code> 
 +mariadb-upgrade -u root -p 
 +</code>
  
 To check all tables in all databases:   To check all tables in all databases:  
 <code> <code>
-mysqlcheck --all-databases -u root -p -c+mariadb-check --all-databases -u root -p -c
 </code>   </code>  
  
 To analyze all tables in all databases:   To analyze all tables in all databases:  
 <code> <code>
-mysqlcheck --all-databases -u root -p -a+mariadb-check --all-databases -u root -p -a
 </code>   </code>  
  
 To repair all tables in all databases:   To repair all tables in all databases:  
 <code> <code>
-mysqlcheck --all-databases -u root -p -r+mariadb-check --all-databases -u root -p -r
 </code>  </code> 
    
 To optimize all tables in all databases:   To optimize all tables in all databases:  
 <code> <code>
-mysqlcheck --all-databases -u root -p -o +mariadb-check --all-databases -u root -p -o 
-</code> +</code> 
 + 
 +All "Check/update database" commands in one block 
 +<code> 
 +systemctl restart mariadb.service 
 +mariadb-upgrade -u root -p 
 +mariadb-check --all-databases -u root -p -c 
 +mariadb-check --all-databases -u root -p -a 
 +mariadb-check --all-databases -u root -p -r 
 +mariadb-check --all-databases -u root -p -o 
 +</code>
  • en/server/services/mariadb.1654299280.txt.gz
  • Last modified: 2022/10/24 08:24
  • (external edit)