Restoring the whole mysql dump is easy. Either use phpMyAdmin(if the file is not too big) or do it from the console. I had a hard time finding it how to restore only one database from the sqldump of all databases.
We have a sqldump file which contains multiple databases. If you want to restore only one of them you should use the –one-database command.
Example:
I have a sqldump.sql which contains databases named dbispconfig, forum, gallery, … . On the target machine first create the database with the same name and then run the folowing command:
mysql -u$username$ -p$password$ --one-database $selected_database$ < $sqldump_file$
If i wanted to select only the “forum” database from the sqldump.sql I would create an empty “forum” database and then run:
mysql -uroot -pMyPass --one-database forum < sqldump.sql
That’s it.
Leave a Reply