AnchovyLegend AnchovyLegend - 7 months ago 19
SQL Question

Mysqldump getting error only when trying to output to file

I am using CMD to do a mysqldump. When I run the following command it works fine:

mysqldump -hmyhost -uroot -pmypass mydb


The dump works just fine, however, when it is done, it seems that no
.sql
file is created for the mysql dump and it just outputs the db data to the screen.

So, I was trying to output the contents to a file using the following command:

mysqldump -hmyhost -uroot -pmypass mydb > C:/mypath/tofile/testdb_dump.sql


But get the following error:

mysqldump: Error: 'Table ' information_schema.files' doesn't exist when trying to dump tablespaces


I greatly appreciate any feedback as to how to resolve this error and backup the db to an
.sql
file.

Many thanks in advance!

Answer

Try mysql -u root -pmypass --opt mydb --no-tablespaces > C:\mypath\tofile\testdb_dump.sql