There are probably more elegant solutions, but I lost the root passwords when
I was first learning MySQL. Since I had no real data there, renamed the mysql
directory holding the tables to mysql.old and restarted mysql. I then started
over with a fresh DB.
This set of instructions has come in handy for a lost mysql root pw where data might be at stake:
http://web.bii.a-star.edu.sg/~atif/mysql.html
Backup is a good thing! I have a cron job that runs every night and backs up all my dbs:
0 0 * * * export test2;declare test2=`date|cut -c 1-3`;mysqldump --all-databases -prootpasswordhere |gzip > /root/sql-backup/all_databases_$test2.sql.gz
The files contain everything needed to recreate the databases.
-- Steve
Good tip! I've been using phpMyAdmin regularly to create a dump file of the tables and data, and saving it elsewhere, but the cron job is obviously nicer (and automated).
Clint