Looking link to learn about using mysql Terminal commands. I have MAMP (LAMP for macintosh) installed in my computer. I'm trying to connect to a remote mysql database using Terminal application on my computer but I get an error message.

What I do is:

  1. Open Terminal app
  2. Go to mysql installation folder with this line: /Applications/MAMP/Library/bin/mysql.
  3. Then I try to connect to remote database with this line: mysql -h 81.238.5.98 -u user_name -p database_name

But I get this error message:

'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 -h 81.238.5.98 -u user_name -p database_name' at line 1

Message says I have a error in my SQL syntax but I see no errors in it. What am I missing here?

link|improve this question

feedback

1 Answer

up vote 1 down vote accepted

Step 3 isn't a command you submit in the MySQL console, but is a mysql program call with parameters. After step 2, you're already connected to your local/default instance.

Replace steps 2 and 3 with

/Applications/MAMP/Library/bin/mysql -h 81.238.5.98 -u user_name -p database_name
link|improve this answer
works! thanks daniel. – chefnelone Jul 7 '11 at 7:43
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.