0

this is what I use in MySQL console (WAMP) (no password, as it is local)

mysql> mysql -u root -p dbase < table.sql

or this

mysql> mysql -u root -p dbase < C:\path\to\table.sql

this is what I get:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'mysql
 -u root -p dbase < table.sql' at line 1

what may cause this problem?

2 Answers 2

1

The command you're using is meant to be run outside of the mysql shell. If you just exit out of the mysql shell and enter the same command, it should work.

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

1 Comment

thank you for your answer - just to point out - my problem was caused by using WAMP link, which calls MySQL server console directly, so any access back to prompt was not possible ... well .. just read my answer, if you wish - again thank you for taking time to answer
0

OK - step by step - since, if someone is not used to it, any omission may get that "someone" lost.


remote nix server:

  1. connect to mysql cli (command line interface) using e.g. Putty - type in: mysql -u user -pyourpassword

  2. now you are connected to MySQL server and you can use e.g. LOAD INFILE command etc.

  3. "exit" gets you back to "-bash" so you can use, e.g. database importing - just type: mysql -u root -p hmvc < table.sql


local WAMP - (setup: WAMP2.2 - Apache2.2.21 - MySQL5.5.20)

case I: using Windows "command prompt"

  1. change directory to the one, where your mysql resides within WAMP root, e.g.: C:\wamp\bin\mysql\mysql5.5.20\bin

  2. connect to mysql cli: mysql -u user -pyourpassword

  3. now you are in, so you can use e.g. LOAD INFILE command etc.

  4. "exit" gets you back to "C:\wamp\bin\mysql\mysql5.5.20\bin>" so you can use, e.g. database importing: mysql -u root -p hmvc < table.sql etc.

case 2: using mysql cli directly

WAMP offers a link to it in its tray icon command collection

link is called: MySQL console

it calls mysql server diretly by invoking C:\wamp\bin\mysql\mysql5.5.20\bin\mysql.exe

  1. you can use all MySQL commands right away, like e.g. LOAD INFILE

  2. you cannot import/dump database using this console if you try to exit, MySQL console will do just that - it will exit (window gets closed)

I hope it will you some time.

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.