PDA

View Full Version : Automatically & regularly repair and optimize all MySQL databases on linux server



Fli
11-16-2014, 06:18 PM
This is what im using to automatically & regularly repair and optimize all MySQL databases on linux server.
If You have any ideas & improvements, please kindly share.. thx

I created script in /root

vi /root/mysqlcheckrepair
insert into:

mysqlcheck -u root -pYOURMYSQLROOTPASSWORD --all-databases --check --auto-repair -F -Cmysql -u root -pYOURMYSQLROOTPASSWORD -e "FLUSH QUERY CACHE"
(having mysql password in readable format is certianly risk)

make executable:

chmod 700 /root/mysqlcheckrepair

create cronjob file. i created it in daily folder so it runs daily..

vi /etc/cron.daily/mysqlcheckrepair

insert into it:

#!/bin/sh/bin/nice -n 19 /bin/sh /root/mysqlcheckrepair

make it executable:

chmod 700 /etc/cron.daily/mysqlcheckrepair