Friday, July 9, 2010

backing up mysql database without mysql root password

This is a quickie, I needed to back up a mysql database without knowing the MySQL root user password.

I had sudo, so the solution was:

sudo /etc/init.d/mysql stop

sudo mysqld_safe --skip-grant-tables &

mysqldump --all-databases | gzip > /tmp/alldb.gz

sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start

there, I told you it was a quickie.

No comments: