CLI Database optimization

MariaDB & MySQL:

sudo apt-get install mysql-client
mysqlcheck -h yourdatabasehost -u root -p --auto-repair --check --all-databases
mysqlcheck -h yourdatabasehost -u root -p --auto-repair --optimize --all-databases

PostgreSQL:

vacuumdb -afvz -h yourdatabasehost -U postgres
reindexdb -a -h yourdatabasehost -U postgres
 
*updated* November, 04, 2021
Docker example:
docker exec -it postgres-server vacuumdb -afvz -U postgres
Comments

Comments are Disabled