Friday, August 21, 2009
How to restore a mysqldump file?
Keywords: restore, mysqldump file, how to restore mysqldump file
Problem/Query:
How to restore a mysqldump file?
Its a big question that will require answer only if something goes wrong. The answer is as simple as follows
Solution:
Restore mysqldump file - Way1:
Restore mysqldump file - Way2:
Important Note:
Please ensure that your .sql file contains a line "use dbname;"; otherwise it will end up with errors saying that "no database selected". In such cases, you can follow "Way2".
Problem/Query:
How to restore a mysqldump file?
Its a big question that will require answer only if something goes wrong. The answer is as simple as follows
Solution:
Restore mysqldump file - Way1:
mysql -u username -p < /path-to/filename.sql
alternatively if its an automated restoration (wherein you won't be there to specify the password)mysql -u username -ppassword < /path-to/filename.sql
Restore mysqldump file - Way2:
1. Login to mysql
2. Select the database you want to import the sql
e.g. use db_name;
3. Execute the sql script using source command.
e.g. source /path-to/filename.sql
Important Note:
Please ensure that your .sql file contains a line "use dbname;"; otherwise it will end up with errors saying that "no database selected". In such cases, you can follow "Way2".
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment