I have a backup mySQL database file which contains a few table structures and a few default records. But when I try to recover to the new database and new system that I just installed, it fails.
How can I recover the file 'db' to mysql?
$ mysql --user=root < /media/Iomega_HDD/20110416/db
ERROR 1046 (3D000) at line 22: No database selected
$ mysql --user=root localhost < /media/Iomega_HDD/20110416/db
ERROR 1049 (42000): Unknown database 'localhost'
Try:
mysql -u root -p DATABASE_NAME_GOES_HERE < input.sql
The -p switch tells it you're going to type in a password. Because you HAVE set a password on your MySQL root account, right? Right?