Since you are connecting through a SSH tunnel, this means that the MySQL port 3306 from us-east-1.amazonaws.com is being opened locally on your computer. The ip address of your computer is 127.0.0.1 or localhost. When you connect to the mysql server on us-east-1.amazonaws.com, you're actually accessing it via 127.0.0.1, i.e. your computer. If you had another tunnel open, or MySQL running locally on your computer, then it may be that other MySQL server that's rejecting your authentication attempts
There are some tests you can try :
1. What ports is you Windows computer listening on
From a command prompt : netstat -a (lists all the ports that are open)
In linux it would be : netstat -tlpn
2. Basic connectivity test
From a DOS command prompt or linux console : telnet 127.0.0.1 3306
If you get a time out, or some other program responds then your tunnel isn't setup correctly.
3. Change the port number that MySQL Workbench is opening locally
We're assuming that MySQL workbench is creating the tunnel on your computer. If so, in MySQL workbench, try tunneling through another port number like 9000.
Make sure that 9000 wasn't listed as an open port from : netstat -a
If you have ssh access to us-east-1.amazonaws.com
4. Try connecting to MySQL from us-east-1.amazonaws.com
mysql -u myuser -h 127.0.0.1 -p
And as Rolando said, you'll want to verify that you are connecting with the right credentials. For example, if you are connecting as myuser@127.0.0.1 and you have a user myuser without a host, you probably won't be able to connect using user@127.0.0.1.
On Windows, there isn't an exact equivalent to a .bash_history
because cmd.exe
is an intrinsically different type of shell. I think you're referring more to the .psql_history
(see related question).
There is a "SQL Shell" available in the SQL Command Line Terminal of the EnterpriseDB Windows distribution of PostgreSQL that supports a command history. However, I prefer to use the Windows command prompt instead of the GUI.
The error message you are getting indicates that psql.exe
was built without readline
support (reference).
The best way I have found to run psql
via the normal Windows command prompt is to create a shortcut:
Target: %SystemRoot%\system32\cmd.exe /U /c "chcp 1252 & C:\Progra~1\PostgreSQL\9.6\bin\psql.exe -U database_username -d database_name"
The command history can be controlled via Command history Buffer size
in the Options pane:
And you can adjust the scrollable output via Screen Buffer Height
in the Layout pane:
This will get you a history via the up and down arrows, but only within your current session. It will not be preserved across sessions.
Best Answer
You cannot run OS commands in a MySQL CLI nor in MySQL Workbench. Why would you do that (except for trying to hack a machine via an SQL connection)?If you need to run an OS command, open a normal shell window (that still stands).Update: The system command only works on Unix like OSes (http://dev.mysql.com/doc/refman/5.6/en/mysql-commands.html), e.g. Linux + Mac.
MySQL Workbench doesn't support most of these CLI commands however (
use
anddelimiter
are 2 that are supported).