Im trying to schedule a mysqldump with crontab as root… but cant get it to work.
My cron expression is ok and the mysqldump line (i can run other task with the expression and manually start the mysqldump)
I get no errors (that i can find), it simply dont create a sql dump
I use the full path to the mysqldump executable, is the ”environment” different from root:s when a cron expression is fired somehow?
Anyone got an idea?
(Im a Linux newbie)
For security reasons openSUSE is set up to prevent you logging into mysql from root. That doesn’t apply if you use mysqldump after su – as an ordinary user. So, and I’m not sufficiently conversant with cron to know how to do that, if you can set up a cron task under a user using su or sudo, I assume it would work.
Il try to use a normal user account instead of root.
you may also want to look into this dumpmysql CLI-Apps.org
alternatively you can get it from my repo too
I have a mysqldump job running from a root cron job and it works fine.
The thing to remember is that when you run any mysql program from an account, the default mysql user is the account user. You can override this with -u user. You don’t show your command or your setup so we have no idea what user you are meant to use.
This also means that you don’t have to run mysqldump as root but from any account, since the mysql accounts are separate from Linux login accounts.
BTW, the MySQL online manual shows various ways of providing the password for an non-interactive mysql program. Safest is to put it in a section of $HOME/.my.cnf and make sure the permissions of that are 0600 or 0400.
It was really stupid on my part… I didn’t supply I path to where I wanted my sql dump, and when testing I where in the folder I wanted it in. Cron/mysqldump as root worked out just fine, the sql dump was simply saved in my home account path.
I will definitely try to use $HOME/.my.cnf, now I supply the password in clear text with –p & -u
Sorry and thanks!