Вопрос

I created a good sized DB in MySQl on Windows tonight. I need to export this data to a SQL file and I'd like to load a copy of it on another machine using this file. When I use

mysql.exe  -u user -p foo < bar.sql

It act likes it's importing the data, by that I mean it takes a while. Then I go and select my db, and show tables, nothing. I exported my data from MySQL workbench 6.1.

edit: I've also verified the data is in fact in the SQL file from the export.

Это было полезно?

Решение

Use mysqldump, it works like a charm.

mysqldump.exe -u user -p foo > dump.sql

and than you can import it in another machine

Другие советы

Important note:

shell> mysql -ptest
shell> mysql -p test

The first command instructs MySQL to use a password value of test, but specifies no default database. The second instructs MySQL to prompt for the password value and to use test as the default database. So double check how you invoke the command and its parameters.

Also for exporting data into *.sql file it is better to use mysqldump.exe utility. Read more here.

try this:

mysqldump -d -u username_user -p username_dbname > file.sql

Where username_dbname is the name of your database, and file.sql is the name of the file you would like to write the table structure to. It will prompt you for a password (-p) and this is required. Normally, mysqldump gives you the entire database, with the -d option, you tell it to not include the data, but just the table structure.

https://my.bluehost.com/cgi/help/180

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top