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
Code:
vi /root/mysqlcheckrepair
insert into:
Code:
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:
Code:
chmod 700 /root/mysqlcheckrepair
create cronjob file. i created it in daily folder so it runs daily..
Code:
vi /etc/cron.daily/mysqlcheckrepair
insert into it:
Code:
#!/bin/sh/bin/nice -n 19 /bin/sh /root/mysqlcheckrepair
make it executable:
Code:
chmod 700 /etc/cron.daily/mysqlcheckrepair
Bookmarks