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?


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

Try forcing TCP protocol:

mysql --port=3808 --protocol=TCP -u root -p
  • It works,thank you! It's strange that mysql in command-line do not read the my.ini which I think it should. – Mithril Aug 30 '13 at 5:49

[mysqld] section is for your server while mysql cli uses [client] section

The [client] option group is read by all client programs (but not by mysqld). This enables you to specify options that apply to all clients. For example, [client] is the perfect group to use to specify the password that you use to connect to the server


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.