I want to be able to programmatically query the Amazon MySQL instance from my local server.
I have been able to setup MySQL workbench to use the ec2 server to create an ssh connection and then to connect to the MySQL server, so I can query the database through the workbench query window. But haven't been able to find a way to do the same using the command line tools?
Use an SSH client (ssh on Linux/OSX or PuTTY on Windows) to connect via SSH into your AWS instance. Then, navigate to the directory where the MySQL command-line utility (mysql) is stored (presumably in usr/bin). Log in like so:
mysql -h localhost -u [USERNAME] -p [PASSWORD]
mysql is the MySQL command-line utility. The -h (host) option is set to localhost since you're already operating from the AWS instance, and I am assuming that your MySQL installation is on the same server. The -u and -p options are self-explanatory (username and password).
I want to be able to programmatically query the Amazon MySQL instance from my local server.
I have been able to setup MySQL workbench to use the ec2 server to create an ssh connection and then to connect to the MySQL server, so I can query the database through the workbench query window. But haven't been able to find a way to do the same using the command line tools?
Use an SSH client (ssh on Linux/OSX or PuTTY on Windows) to connect via SSH into your AWS instance. Then, navigate to the directory where the MySQL command-line utility (mysql) is stored (presumably in usr/bin). Log in like so:
mysql -h localhost -u [USERNAME] -p [PASSWORD]
mysql is the MySQL command-line utility. The -h (host) option is set to localhost since you're already operating from the AWS instance, and I am assuming that your MySQL installation is on the same server. The -u and -p options are self-explanatory (username and password).
0 commentaires:
Enregistrer un commentaire