Mysql – Can’t connect to MySQL server on ‘localhost’ after changing TCP/IP Port

localhostMySQLport

When I change the TCP/IP Port the MySQL Server will listen on
port=3306 to port=3808 in my.ini, my Django project works very well. Navicat also can login in to mysql with same user name and password.

But I can't login into mysql via the command-line. Logins to mysql give this error:

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

Even if I add skip-name-resolve to the [mysqld] block in my.ini. The error only disappears when I change the port back to 3306.

How can I resolve this problem?

Best Answer

What is the command you're using to log in?

Try forcing TCP protocol:

mysql --port=3808 --protocol=TCP -u root -p