I am looking for a way to schedule a database table optimisation on all MySQL data.
Currently I can do it by using the mysqlcheck -o --all-databases
command, and I thought about scheduling it with cron, but the problem is that the password would remain cleartext inside /etc/crontab.
There is a scheduling feature in MySQL, but I don't know how it could fit the need, it sends MySQL commands, it doesn't launch shell programs.
Any tips?
Can use cron, use the --defaults-extra-file option to specify a file, in my.cnf format. It can contain the username/password needed.
Use standard linux permissions to make it only readable to the user running the cron task.
See third bullet-point here: http://dev.mysql.com/doc/refman/5.1/en/password-security-user.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.