Home > Database > Mysql Tutorial > Why Can't I Connect to My MySQL Server (Error Code 2003)?

Why Can't I Connect to My MySQL Server (Error Code 2003)?

DDD
Release: 2024-12-05 02:47:10
Original
916 people have browsed it

Why Can't I Connect to My MySQL Server (Error Code 2003)?

Can't Connect to MySQL Server: Error Code 2003

Issue:

When attempting to establish a connection to a MySQL server at '127.0.0.1' using the 'mysql' command, the following error occurs:

ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
Copy after login

Solution:

For Ubuntu (without MySQL replication enabled):

  1. Edit the file '/etc/mysql/my.cnf' using 'vim'.
  2. Locate the line 'bind-address = 127.0.0.1' and comment it out by adding a '#' symbol at the beginning of the line:

    # bind-address = 127.0.0.1
    Copy after login
  3. Save the file and restart the MySQL server.

For cases where MySQL replication is enabled:

Instead of connecting to 'localhost' or '127.0.0.1', specify the IP address for which the MySQL server is configured to bind to in the 'my.cnf' file.

The above is the detailed content of Why Can't I Connect to My MySQL Server (Error Code 2003)?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template