I had trouble installing a local installation of mysql, so I have a connection to a remote mysql database via an IP tunnel, I connect to it via typing localhost in perl and python scripts. Something weird is happening and I want to check the connection from the command line rather than the script. Is there a BASH command line that I can type to connect to the mysql db as localhost?
Thanks
2 Answers 2
Err, have you tried the mysql client? It defaults to localhost if -h is not specified.
2 Comments
-h to have any hostname or IP you like.If you want to test MySQL commands from the command line then you will have to install the MySQL command line client.
Another option is to get MySQL GUI Tools, which includes the MySQL query browser. You can execute commands in the query browser just like on the command line.
If you just want to test if the port is open then you can try connecting to it using telnet or netcat:
nc localhost 3306
If the MySQL server is running and you can connect then you should see a version number and then some random characters. Then you will have to press Ctrl-C to cancel the connection. You can't execute SQL like this.