0

I am running the following command as given on web to connect the mysql data base but it gives syntax error new line expected here is the command i am entering.

mysql -<hivelettest.c0e9graawyhr.us-west-2.rds.amazonaws.com  -p 3306  -u <user> -p <pass>
Mihai
  • 26,325
  • 7
  • 66
  • 81
Aijaz Ali
  • 353
  • 2
  • 6
  • 17

2 Answers2

-1

The <> parts of the command were given to show where the username and password should go. They shouldn't be in the command:

mysql -hmydbserver.co.uk  -P3306  -u username -pmypassword
Jim
  • 22,354
  • 6
  • 52
  • 80
  • 1
    there is no white space between the -p and the password – T0to Dec 03 '13 at 09:42
  • @AijazAli That means that the MySQL command isn't found, I'm not familiar with Macs but this link may help: http://stackoverflow.com/questions/10577374/mysql-command-not-found – Jim Dec 03 '13 at 10:21
-1

Try this, and make sure that there is no space between -u or -p. And if you are using PORT you need to write it differently. The password parameter must then be --password=

mysql -hmydbserver.co.uk  -P 3306  -uUsername --password=yourpassword

Since 3306 is the standard one you could leave it out, then you can write it like this.

mysql -hmydbserver.co.uk  -uUsername -pYourpassword

If you want to pass with a command, do it like this.

 mysql -hmydbserver.co.uk  -P 3306  -uUsername --password=yourpassword nameofdatabase 
 -e "SELECT * FROM tablename"
Mad Dog Tannen
  • 7,129
  • 5
  • 31
  • 55
  • @AijazAli Is the `mysql` program in your `$PATH`? – Barmar Dec 03 '13 at 09:50
  • @Barmar how to check mysql is in path – Aijaz Ali Dec 03 '13 at 09:56
  • `echo $PATH` and look at the list of directories to see if it includes the directory that contains mysql? – Barmar Dec 03 '13 at 09:56
  • but i have xamp installed on my mac – Aijaz Ali Dec 03 '13 at 10:08
  • Its requesting a command to be executed. Did you try the latest change? mysql -hmydbserver.co.uk -P 3306 -uUsername --password=yourpassword nameofdatabase -e "SELECT * FROM thenameofanytable" - Does this still give you "no command found?" – Mad Dog Tannen Dec 03 '13 at 10:12
  • CAn you run this and tell me the error message? mysql -hmydbserver.co.uk -P 3306 -uUsername --password=yourpassword nameofdatabase -e "'SELECT * FROM thenameofanytable". It should give a syntax error – Mad Dog Tannen Dec 03 '13 at 10:22