I have a .sql file generated by MysqlDump. How can i restore it via command prompt
+2
A:
$ mysql database < myfile.sql
OR
$ mysql database
mysql> source myfile.sql
scompt.com
2010-06-11 07:53:13
A:
Seth
2010-06-11 07:53:38
I am using normal window cmd..And i tried this. But no results and no error..... C:\MySQL\MySQL Server 5.0\bin>mysql -uroot -ppassword mysql > source d:\admindb\ aar12.sql
Anuya
2010-06-11 08:06:40
The syntax is as I wrote above. What you've done there is redirect the output of the `mysql` command a file called `source` in your working directory. (Your redirection arrow is pointing the wrong way, should be `<`, and you have too many parameters).
Seth
2010-06-11 16:47:17
A:
mysql -uusername -ppassword databasename < file.sql
or if the file is gzipped (like my backups mostly are) then something like this:
gunzip file.sql.gz | mysql -uusername -ppassword databasename
Nathan Reed
2010-06-11 07:55:38
A:
- get to bin directory of mysql using command prompt
- log in to mysql
- run source command with file parameter
Example :
cd C:\mysql\bin
mysql -u root -p
mysql > source c:\myfile.sql
Xorty
2010-06-11 07:56:11
You don't have to be in the MySQL bin directory if your system is sane, and by sane, I mean has the MySQL bin directory in the PATH.
icktoofay
2010-06-11 07:58:06
I am using normal window cmd..And i tried this. But no results and no error.....C:\MySQL\MySQL Server 5.0\bin>mysql -uroot -ppassword mysql > source d:\admindb\aar12.sql
Anuya
2010-06-11 08:05:51
I am not getting any errors. But there is no update when i see in my query browser. The script works fine when executing manually in query browser. Tried this in cmd : C:\MySQL\MySQL Server 5.0\bin>mysql -uroot -ppassword source d:\admindb\AAR12.sql
Anuya
2010-06-11 09:15:37