0

I want to import an .sql file into a database on my local WAMP environment on Win7 64bit. I used this command before already, and it worked then - now, it just seems to fail without an error. Instead, MySQL simply returns the help/usage file.

My import command: mysql.exe -u root -p password database_name < db.sql

MySQL returns:

mysql.exe Ver 14.14 Distrib 5.1.53, for Win64 (unknown) Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Usage: mysql.exe [OPTIONS] [database]

(followed by the long list of possible commands).

When I type a different command such as: mysql.exe use database_name, the exact same thing happens. This leads me to believe there is something wrong with my setup.

What am I doing wrong? Thanks!

bobsoap
  • 4,844
  • 7
  • 30
  • 43
  • what is the .sql file size? Try to increase the accepted filesize, timeout parameters in mysql.ini – Nikos M. Mar 12 '15 at 14:13
  • The file is 360MB. I only have a my.ini; the `max_allowed_packet` was 16M. I just set it to 1024M, but I'm still getting the same error... – bobsoap Mar 12 '15 at 14:19
  • yes my.ini, related http://stackoverflow.com/questions/12425287/mysql-server-has-gone-away-when-importing-large-sql-file – Nikos M. Mar 12 '15 at 14:20
  • MySQL didn't go away in this case - that's the issue. There are no kinds of errors, neither in the output nor in the log. Thanks for the reference, but unfortunately it doesn't seem to do anything here. – bobsoap Mar 12 '15 at 14:25
  • same difference, sometimes it goes away or just stops importing more, it is a case of my.ini configuration – Nikos M. Mar 12 '15 at 14:26
  • unless your .sql has errors – Nikos M. Mar 12 '15 at 14:27

3 Answers3

0

You are not supposed to enter the password on the command line, in ase someone is looking over your shoulder (security). You just enter the -p to make sql.exe prompt you for the passord.

So instead of this

My import command:

mysql.exe -u root -p password database_name < db.sql

Try this :

mysql.exe -u root -p database_name < db.sql

mysql.exe will then ask you for the password and then comeplete the requested actions.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
0

One of my colleagues had this error and he had an em dash instead of a dash -. Replacing the em dash by the dash solved this problem.

Martin S.
  • 21
  • 7
0

The problem for my case is I put a semi-colon at the end of the command. Remove it, problem gone.

Minjun Yu
  • 3,497
  • 4
  • 24
  • 39