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
精彩评论