Bug #50007 Import From Disk doesn't import anything
Submitted: 31 Dec 2009 0:01 Modified: 28 Jan 2010 22:39
Reporter: Barry Galbraith Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench: Administration Severity:S3 (Non-critical)
Version:5.2.11 Beta OS:Windows (XP Pro SP3)
Assigned to: CPU Architecture:Any

[31 Dec 2009 0:01] Barry Galbraith
Description:
Import from disk doesn't load any data.

How to repeat:
Export the tables from a schema to disk. Check that the files exist, and contain sql statements as expected.

Drop all tables from data base using mysql commandline.

Import from Disk
Import from Backup project folder. Browse to find the dumped files.
Load Folder contents to see the table files.
Select all Tables.
Start Import.

The log file shows running mysql, but only importing the first file(table).
No errors reported.
Check the database with mysql commandline shows NO TABLES imported.

Suggested fix:
I ran the reported command from the commandline, and I got an error "Can't find the specified file".
The command line was

 mysql.exe --host=localhost --user=root --password=xxxxxxx --port=3306 --comments<  D:\Documents and Settings\Barry\My Documents\MySQL\backup\workorders_job2id.sql

So, I changed it to 

mysql.exe --host=localhost --user=root --password=xxxxxxx --port=3306 --comments<  "D:/Documents and Settings/Barry/My Documents/MySQL/backup/workorders_job2id.sql"

There was no error, and the table was imported.

The file name needs to have \ chars in the path changed to / or escaped \\
The filename also needs to be quoted to allow for spaces in the filename.
[31 Dec 2009 0:09] Peter Laursen
"The filename also needs to be quoted to allow for spaces in the filename."

Similar issue reported with server and clients several times. Windows command interface requires it. No activity (attitude: only idiots use SPACE in file paths).

Sigh!
[5 Jan 2010 12:03] Susanne Ebrecht
Are spaces or slashes the problem here?
[5 Jan 2010 12:16] Peter Laursen
I believe they both are.

I wrote my comment because I am very annoyed that MySQL developers constantly forget that Windows require "quotes" around file paths with SPACEs.  I think I reported first issue with this mistake 3 years ago, there are at least 5 more and it seems to continue.

It is part of the confusion that the MySQL server on Windows doesn't require those "quotes" (in datadir or tempdir specification for instance).  But the server code does not control the operating system (or put otherwise: if you write in MySQL docs and code in MySQL that the Moon is made from green cheese, the Moon will still not be made from green cheese - because also that is not controlled by the MySQL server!).
[5 Jan 2010 21:02] Barry Galbraith
Both spaces and slashes are a problem.

\ needs to be escaped \\ or changed to /

The path needs to be quoted to account for the possibility of spaces. Windows allows spaces in a path, so Workbench needs to quote a path so that legitimate paths can be handled correctly.
[14 Jan 2010 6:32] Susanne Ebrecht
Verified as described.
[21 Jan 2010 17:42] Jason Thompson
This does not work on Windows 7 x64 either.  When running the output on the command line, I get the following: 

unknown option '--comments<'

The command line I copied and ran was:

mysql.exe --host=127.0.0.1 --user=root --port=3306 --comments<  C:\Users\jthompson\Workspaces\MyClient\ThierProduct\Databases\Dump20100119\thiercustomer_thetablename.sql
[28 Jan 2010 22:39] Alfredo Kojima
Marking as duplicate of bug #50609