Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

restoring a MySQL database

I have created a file named ab.sql using the mysqldump utility of a database named library. It worked fine. Now i am trying to restore it using mysqlimport. My database already exists. But i want to override it. I am using the command

mysqlimport -uroot -p**** library D:/ab.sql

in the command line but it gives an error that says,

mysqlimport: Error: 1146, Table 'library.ab' doesn't exist, when using table: ab

desperately need help.

like image 374
Suman.hassan95 Avatar asked Mar 03 '11 21:03

Suman.hassan95


1 Answers

mysqlimport reads rows from a text file into a database. mysqldump outputs a file full of SQL statements, not simple rows. You can run those SQL statements using:

mysql -u root < D:/ab.sql

Depending on your mysqldump options, this may delete existing data in your database. If you're unsure, I'd grep for "drop" and "delete" to make sure it looks OK.

like image 186
froody Avatar answered Oct 18 '22 04:10

froody