MySQL query syntax


#1

I am trying to run the following query against my database:

mysql -u [DBUSER] -p [DBNAME] < folder/folder/folder/folder/store.mysql

where the first ‘folder’ is within the root of my site, and ‘store.mysql’ is a script residing in the ‘store’ subdirectory.

Mysql complains with the following, which I can’t figure out:

#1064 - 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 [DBUSER] -p [DBNAME] < folder/folder/folder/folder/store.mysql’ at line 1

(I have changed the actual text of the error message to hide the db/folder info).

I know a little SQL but I’m very new to MySQL and it appears the issue is probably related to the path, but I tried deleting folder names and got the same results.

Any help you can provide would be sincerely appreciated!

John


#2

The password has to be next to the switch ie -pPASSWORD, the user needs a space -u USER.
Unless you are doing a crontab/auto script, you should leave out the password (just use switch) in my opinion. Hope that works?


#3

MYSQL doesnt work at DREAM HOST

never has

never will


#4

[quote]MYSQL doesnt work at DREAM HOST

never has

never will[/quote]
What? That simply isn’t true. I’ve had no MySQL problems since moving my accounts here. And with the recent upgrade, we can use subqueries too!


Simon Jessey
Keystone Websites | si-blog


#5

I was going to challenge that claim as well, but I simply am not having success with this query. I’ve tried all of the following:

mysql -u [DBUSER] -p[PASSWORD] [DBNAME] < FOLDER/FOLDER/FOLDER/FOLDER/store.mysql
and
mysql -u [DBUSER] -p[PASSWORD] [DBNAME] < web/FOLDER/FOLDER/FOLDER/FOLDER/store.mysql
and
mysql -u [DBUSER] -p [DBNAME] < FOLDER/FOLDER/FOLDER/FOLDER/store.mysql
and
mysql -u [DBUSER] -p [DBNAME] < web/FOLDER/FOLDER/FOLDER/FOLDER/store.mysql

It’s just a database dump for several civicspace modules and includes. The error indicates that my my syntax is bad.