开发者

restoring with mysqldump, but where is the data?

开发者 https://www.devze.com 2022-12-27 09:33 出处:网络
Ok, so I\'m in need to restore a table and I do: mysqldump --opt database table_name < table_name.sql

Ok, so I'm in need to restore a table and I do:

mysqldump --opt database table_name < table_name.sql 

I hit enter and Done! Well, not really, when I go to see if there is anything on the table it show 0 recor开发者_开发技巧ds.

I have look into the table_name.sql and I see two records.

What am I doing wrong?


mysqldump is the wrong command for restoring from a backup.

You need to run mysql, as in, the mysql client. It's generally something like this:

mysql -u username -p database_name < sqlfile.sql

That will use your file as input to the mysql client, which subsequently executes the SQL.


mysqldump just exports the data to an SQL script. You can restore with this:

mysql db < file.sql
0

精彩评论

暂无评论...
验证码 换一张
取 消