I am successfully using MySQLWorkbench to access and manage a database at 127.0.0.1:3307.
However if I try to access it using the command line:
mysql -u admin -h 127.0.0.1:3307 -p
I get the error message:
ERROR 2005 (HY000): Unknown MySQL server host '127.0.0.1:3307' (0)
Why does it work with MySQLWorkbench and not with the command line?
I am running on OSX
To fix the error, you need to make sure that the mysql.exe file is available under your PATH setting. The mysql.exe file is located on the bin/ folder of your MySQL program, but the location of your MySQL program will depend on what program you use to install MySQL on your computer.
normally means that there is no MySQL server running on the system or that you are using an incorrect Unix socket file name or TCP/IP port number when trying to connect to the server. You should also check that the TCP/IP port you are using has not been blocked by a firewall or port blocking service.
Check that the DB username, DB password, database host, and database port are correct. (if you are unsure, reach out to your database administrator or check in your web hosting account for the up to date credentials). If the config file references host = "localhost" , you can try to change it to 127.0.
Because MySQLWorkbench parses out the port number, and the CLI tool doesn't. There is a separate option --port
for providing it. Try
mysql --user admin --host 127.0.0.1 --port 3307 --password
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With