2003 can t connect to mysql server on

I have been racking my brain over this problem. I'm on a Mac M1 machine.

I will tell you how I installed mysql - i downloaded the natives from their website and installed as per the instructions on this page - https://dev.mysql.com/doc/mysql-macos-excerpt/5.7/en/macos-installation-pkg.html

When I try to connect to our remote mysql server I cannot do it, and see the error in the title.

Should I change my.cnf file? should i kill any running processes?

MySQL is one of the most popular engines for relational databases. It is mighty and provides many features that comply with Standard SQL out of the box.

Before you can use the MySQL database, you will need to set up and configure the MySQL server on your system. Thankfully, MySQL is cross-platform and provides installers for popular operating systems.

However, in some instances, you may encounter the “error 2003. Can’t connect to MySQL server on ‘localhost:3306′” error when attempting to login to MySQL.
In this tutorial, we will discuss the causes of this error and how you can resolve it.

What Causes this Error?

This error occurs when the MySQL Server is not running and cannot connect to the Server.

An example of this error is shown in the screenshot below:

2003 can t connect to mysql server on

Let us now discuss two techniques you can use to resolve this error.

How to Fix this Error?

There are two things you can do to fix this error:

  1. Ensure the MySQL Server is running on your system.
  2. Ensure you specify the target port if the Server is running on a different port.

Fix 1 – Ensure the MySQL Server is Running.

The first step is to verify that the server is running on your system. On your Windows terminal, use the command:

If you get the error shown below:

mysqlshow: Can't connect to MySQL server on 'localhost:3306' (10061)

Then the Server is not running on your system.

To fix it, open the services manager on your Windows system. Press the Windows Key + R to launch the Run utility.

Next, enter “services.msc” and press enter.

2003 can t connect to mysql server on

In the Services Manager, scroll down until you locate the service for your MySQL server. For example, if you have MySQL version 5.0, the service will be under ‘MySQL50’, and MySQL version 8.0 will be under ‘MySQL80’, etc.

2003 can t connect to mysql server on

We have MySQL version 8 installed in the picture above. However, the service is not running as the Status tab is empty.

To fix this, right-click on the service name and press start. This should start the service and ensure the MySQL Server is running.

2003 can t connect to mysql server on

As you can see, the service status changes to ‘Running.’

Now we can connect to MySQL as:

2003 can t connect to mysql server on

In some cases, you may not find the MySQL service in the Services manager. In such a case, you will need to install the MySQL service.

Open the command prompt as an administrator and run the command:

2003 can t connect to mysql server on

The command above should install the MySQL service, allowing Windows to start and stop the service on startup.

Fix 2 – Verify MySQL Port

The MySQL Server will listen on a TCP port on your system. This is the port you will use to connect to the server.

If you have not made any changes to the running port during installation or in the configuration file, MySQL will run on port 3306.

You can verify under which port the server is running by checking the configuration file.

The MySQL configuration file is located in the directory:

C:\ProgramData\MySQL\MySQL Server 8.0

Under the name my.ini.

2003 can t connect to mysql server on

Open the file with your text editor and locate the [client] block. Find the entry defining the running port as shown:

2003 can t connect to mysql server on

Once you have the running port, you need to specify it when logging in to the server.

$ mysql -u root -p --port=[port_number]

NOTE that unless you know what you are doing, it is recommended to leave MySQL as the default running port.

If you changed the running port during installation, you can edit the configuration file and set it to 3306 or run the MySQL installer.

In the installer window, select ‘Reconfigure’ under MySQL Server.

2003 can t connect to mysql server on

Set the connectivity options in the Type and Networking section as TCP/IP and Port to 3306.

2003 can t connect to mysql server on

Follow along with the defaults and apply the changes.

Conclusion

In this article, we explored the causes of the “error 2003 (hy000) can’t connect to MySQL server on ‘localhost’ (10061)” error and various techniques to resolve it.

About the author

2003 can t connect to mysql server on

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list

How do I fix error 2003?

Executing the mysqld command can solve your problem..
Click on the Windows 7 start button and type taskmgr in the search bar..
Right click on the taskmgr program icon and select Run as administrator..
In the Task Manager window, go to the Services tab..
Right click on the MySQL service and click Start Service..

Can't connect to specified instance MySQL error number 2003?

simply means that connection is not possible for one of the following (or similar) reasons: There is no MySQL server running at the specified host. Connection to the MySQL server is not allowed using TCP-IP. Check the 'skip-networking' setting in the MySQL configuration file (my.

How do I fix MySQL host is not allowed to connect to this server?

To fix this, add a user that allows your host. To allow any host, use the wildcard symbol %. You can add a user from the command line or with a UI client (such as MySQL Workbench or phpMyAdmin). I'll show an example below of adding a user that allows any host.

Can't connect to MySQL server on timed out?

A Connection Timed Out error occurs when the database's firewall won't allow you to connect to the database from your local machine or resource. If you are getting this error, check that you have added the machine or resource you are connecting from to the database's list of trusted sources.