1
openextreme < 'www/downloads/official_games_db.sql'

That's the line. I've tried it with and without quotes, double quotes, the full file path, just the file name, etc. I want official_games_db.sql (a table) imported into the database openextreme (which does exist). The file is good, as importing it through phpMyAdmin works flawlessly. But for various reasons, I'm looking to get it done through the command line.

I keep getting error 1064, syntax, but no real help beyond that. I've searched, and from what I can tell, I have it correct. I've tried it with and without semicolon at the end too. I'm at my wits end. Any and all help greatly appreciated.

Thank you in advance.

6
  • 1
    from where are you running this command? It should be run from shell and not from MySQL command line. Also, the command should be mysql -u username -p password openextreme < www/downloads/official_games_db.sql Commented Oct 7, 2012 at 0:26
  • I'm not sure what the difference is between shell and MySQL command line. I thought they were the same thing. I'm running this on WAMP (I MUST use Windows for this project). I've tried from the MySQL command line and from phpMyAdmin, as well as through AutoHotKey. No joy. Thanks for the help. Let me try what you've suggested. Commented Oct 7, 2012 at 0:46
  • That's what's so frustrating. I tried it from the console and from phpMyAdmin as written above (Virenda's approach). Still getting the same 1064 error. By all rights, this should work. But the word 'should' exists for a reason, no? Thanks for the help thus far. Just need a little more apparently. Commented Oct 7, 2012 at 0:51
  • By shell I meant the login into server. Anyways, if you are using WAMP, you can use the import feature in PHPMyAdmin. No need to use this command. The only problem you might face is the max_upload_limit of you server, which you might have to change in your apache and/or php config. Commented Oct 7, 2012 at 2:30
  • Virenda, thanks for your help. I've successfully imported using PHPMyadmin. However, for the project I'm working on, I want to be able to do it with a command, which can be run from a script/batch file, which can be scheduled to run every 6 hours or 24 hours or whatever. That's why I'm so focused on getting the command to work. Any more thoughts? You've been very helpful thus far. Commented Oct 7, 2012 at 2:49

1 Answer 1

1

mysql -u username -p databasename < path/example.sql

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.