MySQL Error:10061


Apparently, I cannot connect to SQL server using the mysql.exe

I logged in as the root user and typed the following

mysql -u root -p
mysql> CONNECT TO;

I receive the folling error.

ERROR 2005 (HY000): Unknown MySQL server host '127.0.01:3306' (2)

Unknown MySQL server host '' (2)

However it connects justs fine using MySQL Workbench with the same parameters.

User: root

I have the easyphp MySQL module installed. Could this be the reason?

EDIT: TYPO with sorry

Best Solution

According to the documentation, the syntax of the connect command is:

connect [db_name host_name]], \r [db_name host_name]]

Reconnect to the server. The optional database name and host name arguments may be given to specify the default database or the host where the server is running. If omitted, the current values are used.

Therefore your command CONNECT TO is attempting to connect to a database called TO on a host called The error message you receive in return unsurprisingly complains that the host does not exist.

However, it is more usual to specify the hostname and database on invoking mysql (whereupon one can also specify the port if one wishes - see this page for a full list of command line options):

mysql -u username -p -h <hostname> -P <port> db_name

Also note that if the hostname and port are not specified, they default to localhost and 3309 - therefore in your case you can omit all of the above and just go with:

mysql -u username -p db_name

To do what you're currently doing (not specifying the database name on the command-line), you must call the USE command at the mysql> prompt to select a database after you've connected:

mysql -u username -p
mysql> USE db_name;