I recently installed MySQL 5 on Windows 2003 and tried configuring an instance. Everything worked fine until I got to «Applying Security settings», at which point it gave me the above error (Can't connect to MySQL server on 'localhost' (10061)
).
I do have a port 3306 exception in my firewall for ‘MySQL Server’.
Ian Gregory
5,7601 gold badge29 silver badges42 bronze badges
asked Sep 23, 2008 at 3:52
Cameron A. EllisCameron A. Ellis
3,8338 gold badges38 silver badges46 bronze badges
0
Got this error on Windows because my mysqld.exe wasn’t running.
Ran «C:Program FilesMySQLMySQL Server 5.5binmysqld» —install from the command line to add it to my services, ran services.msc (start -> run), found the MySQL service and started it.
Didn’t have to worry about it from there on out.
answered Oct 11, 2011 at 4:18
1
To resolve this problem:
- go to the task manager
- select Services tab
- find MySql service
- Running
That’s all.
TLama
75k17 gold badges213 silver badges387 bronze badges
answered Mar 12, 2014 at 12:55
5
You’ll probably have to grant ‘localhost’ privileges to on the table to the user. See the 'GRANT'
syntax documentation. Here’s an example (from some C source).
«GRANT ALL PRIVILEGES ON %s.* TO ‘%s’@’localhost’ IDENTIFIED BY ‘%s'»;
That’s the most common access problem with MySQL.
Other than that, you might check that the user you have defined to create your instance has full privileges, else the user cannot grant privileges.
Also, make sure the mysql service is started.
Make sure you don’t have a third party firewall or Internet security service turned on.
Beyond that, there’s several pages of the MySQL forum devoted to this:
http://forums.mysql.com/read.php?11,9293,9609#msg-9609
Try reading that.
Sathish D
4,84430 silver badges44 bronze badges
answered Sep 23, 2008 at 3:58
ChrisChris
4,8421 gold badge22 silver badges17 bronze badges
English:
- press Windows + R
- write «services.msc». Then press Enter
- search for MySQL57 and right click
- click on start the service
Français :
- Appuyez sur la touche Windows + R
- Écrire «services.msc» Puis appuyez sur Entrée
- Recherchez MySQL57 et clic droit
- Cliquez sur rédémarrer
jpaugh
6,5454 gold badges37 silver badges90 bronze badges
answered Jul 6, 2017 at 8:19
SofiaSofia
1592 silver badges9 bronze badges
1
I had difficulty accessing MySQL while connecting via a localhost connection on the standard port 3306, which worked fine when I installed and configured it for prior classes I had taken in MySQL and Java. I was getting errors like «error 2003» and «Cannot connect to MySql server on localhost (10061)». I tried connecting from both MySQL Workbench (5.2.35 CE) and Netbeans (7.2). I am using Windows 7 64 bit professional.
I tried typing in services.msc in the start menu search box, which opened the services dialog box to show all the services installed in windows. I scrolled down to MySQL and started this service. Subsequent attempts to connect to MySQL from MySQL WorkBench and from the command prompt succeeded.
answered Nov 1, 2012 at 1:13
ColinColin
7196 silver badges3 bronze badges
1
press Windows key + R
write «services.msc» enter
search for «MYSQL56»
write click on it and start the service
answered Nov 20, 2015 at 3:34
Mujtaba ZaidiMujtaba Zaidi
6191 gold badge6 silver badges14 bronze badges
-
Make sure that your windows host file (located at
c://windows/system32/drivers/etc.host
) has following line. If not, add it at the end127.0.0.1 localhost ::1 localhost
-
Sometimes mysql can not trigger Windows to force start host services if firewall blocks it, so start it manually
win+run>>services.msc, select the «MySQL_xx» where «xx» is the name you have assigned to MySQL host services during setup. Click on ‘start’ to start from hyperlink appeared on left side.
piet.t
11.7k21 gold badges42 silver badges52 bronze badges
answered Oct 2, 2013 at 12:57
Uday HiwaraleUday Hiwarale
4,0286 gold badges45 silver badges48 bronze badges
3
I tried Kuzhichamadam Inn’s solution and found that a slight change needed to be made.
MYSQL57 was a network service. I had tried this repeatedly with no success. When I opened services.msc I found another service for localhost: MySQL. I started that one using the process below and it worked.
run > services.msc > rightclick MySQL > properties >start
answered Jul 6, 2016 at 21:17
0
I got this error when I ran out of space on my drive.
answered Jul 1, 2016 at 15:02
MDaveMDave
1,20513 silver badges29 bronze badges
Go to Run type services.msc.
Check whether or not MySQL services are running. If not, start it manually. Once it is started, type MySQL Show
to test the service.
answered Aug 24, 2017 at 6:12
To connect locally to MySql
, you do not have to setup a firewall with inbound rules. But, even if you already setup iptables
to allow the TCP
inbound port 3306 and grant the privilege to the user to access the db locally, you may have to setup the bind address in your my.cnf
file, edit the default address there and put the server IP address that is running the MySql
service.
Brian
5,0597 gold badges36 silver badges47 bronze badges
answered Aug 16, 2013 at 19:46
0
Since I have struggled and found a slightly different answer here it is:
I recently switched the local (intranet) server at my new workplace. Installed a LAMP; Debian, Apache, MySql, PHP. The users at work connect the server by using the hostname, lets call it «intaserv». I set up everything, got it working but could not connect my MySql remotely whatever I did.
I found my answer after endless tries though. You can only have one bind-address and it cannot be hostname, in my case «intranet».
It has to be an IP-address in eg. «bind-address=192.168.0.50».
answered Jan 28, 2016 at 8:34
run > services.msc > rightclick MySQL57 > properties >set start type option to automatic
after restarting computer
At cmd
cd: C:
C :> cd "C:Program FilesMySQLMySQL Server 5.7bin"
it will become
C:Program FilesMySQLMySQL Server 5.7bin>
type mysql -u root -p
ie C:Program FilesMySQLMySQL Server 5.7bin> mysql -u root -p
Enter password: ****
That’s all
It will result in
mysql>
Phiter
14.5k14 gold badges50 silver badges84 bronze badges
answered Mar 9, 2016 at 14:22
Another possibility:
There are two ways the MySQL client can connect to the server: over TCP/IP, or using sockets. It’s possible you have your MySQL server configured to support socket connections, but not network connections.
answered Sep 23, 2008 at 4:49
dj_segfaultdj_segfault
11.9k4 gold badges29 silver badges37 bronze badges
1
Nothing to do just «Reset to Default» your firewall setting it will start working.
I read many solutions but nothing worked properly, so at last I reset firewall settings which worked.
answered Apr 17, 2013 at 8:13
1
finally solved this.. try running mysql in xammp. The check box of mysql in xammp should be unclicked. then start it. after that you can open now mysql and it will now connect to the localhost
answered Dec 15, 2013 at 3:42
1
Edit your ‘my-default.ini’ file (by default it comes with commented properties)as below ie.
basedir=D:/D_Drive/mysql-5.6.20-win32
datadir=D:/D_Drive/mysql-5.6.20-win32/data
port=8888
There is very good article present that dictates commands to create user, browse tables etc ie.
http://www.ntu.edu.sg/home/ehchua/programming/sql/MySQL_HowTo.html#zz-3.1
answered Aug 6, 2014 at 13:53
hmehandihmehandi
3464 silver badges11 bronze badges
- Right click on My Computer
- Click on Manage
- Go to Services and Application
- Select Services and find MySQL service
- Right click on MySQL and select Start
answered Aug 11, 2016 at 7:28
I recently installed MySQL 5 on Windows 2003 and tried configuring an instance. Everything worked fine until I got to «Applying Security settings», at which point it gave me the above error (Can't connect to MySQL server on 'localhost' (10061)
).
I do have a port 3306 exception in my firewall for ‘MySQL Server’.
Ian Gregory
5,7601 gold badge29 silver badges42 bronze badges
asked Sep 23, 2008 at 3:52
Cameron A. EllisCameron A. Ellis
3,8338 gold badges38 silver badges46 bronze badges
0
Got this error on Windows because my mysqld.exe wasn’t running.
Ran «C:Program FilesMySQLMySQL Server 5.5binmysqld» —install from the command line to add it to my services, ran services.msc (start -> run), found the MySQL service and started it.
Didn’t have to worry about it from there on out.
answered Oct 11, 2011 at 4:18
1
To resolve this problem:
- go to the task manager
- select Services tab
- find MySql service
- Running
That’s all.
TLama
75k17 gold badges213 silver badges387 bronze badges
answered Mar 12, 2014 at 12:55
5
You’ll probably have to grant ‘localhost’ privileges to on the table to the user. See the 'GRANT'
syntax documentation. Here’s an example (from some C source).
«GRANT ALL PRIVILEGES ON %s.* TO ‘%s’@’localhost’ IDENTIFIED BY ‘%s'»;
That’s the most common access problem with MySQL.
Other than that, you might check that the user you have defined to create your instance has full privileges, else the user cannot grant privileges.
Also, make sure the mysql service is started.
Make sure you don’t have a third party firewall or Internet security service turned on.
Beyond that, there’s several pages of the MySQL forum devoted to this:
http://forums.mysql.com/read.php?11,9293,9609#msg-9609
Try reading that.
Sathish D
4,84430 silver badges44 bronze badges
answered Sep 23, 2008 at 3:58
ChrisChris
4,8421 gold badge22 silver badges17 bronze badges
English:
- press Windows + R
- write «services.msc». Then press Enter
- search for MySQL57 and right click
- click on start the service
Français :
- Appuyez sur la touche Windows + R
- Écrire «services.msc» Puis appuyez sur Entrée
- Recherchez MySQL57 et clic droit
- Cliquez sur rédémarrer
jpaugh
6,5454 gold badges37 silver badges90 bronze badges
answered Jul 6, 2017 at 8:19
SofiaSofia
1592 silver badges9 bronze badges
1
I had difficulty accessing MySQL while connecting via a localhost connection on the standard port 3306, which worked fine when I installed and configured it for prior classes I had taken in MySQL and Java. I was getting errors like «error 2003» and «Cannot connect to MySql server on localhost (10061)». I tried connecting from both MySQL Workbench (5.2.35 CE) and Netbeans (7.2). I am using Windows 7 64 bit professional.
I tried typing in services.msc in the start menu search box, which opened the services dialog box to show all the services installed in windows. I scrolled down to MySQL and started this service. Subsequent attempts to connect to MySQL from MySQL WorkBench and from the command prompt succeeded.
answered Nov 1, 2012 at 1:13
ColinColin
7196 silver badges3 bronze badges
1
press Windows key + R
write «services.msc» enter
search for «MYSQL56»
write click on it and start the service
answered Nov 20, 2015 at 3:34
Mujtaba ZaidiMujtaba Zaidi
6191 gold badge6 silver badges14 bronze badges
-
Make sure that your windows host file (located at
c://windows/system32/drivers/etc.host
) has following line. If not, add it at the end127.0.0.1 localhost ::1 localhost
-
Sometimes mysql can not trigger Windows to force start host services if firewall blocks it, so start it manually
win+run>>services.msc, select the «MySQL_xx» where «xx» is the name you have assigned to MySQL host services during setup. Click on ‘start’ to start from hyperlink appeared on left side.
piet.t
11.7k21 gold badges42 silver badges52 bronze badges
answered Oct 2, 2013 at 12:57
Uday HiwaraleUday Hiwarale
4,0286 gold badges45 silver badges48 bronze badges
3
I tried Kuzhichamadam Inn’s solution and found that a slight change needed to be made.
MYSQL57 was a network service. I had tried this repeatedly with no success. When I opened services.msc I found another service for localhost: MySQL. I started that one using the process below and it worked.
run > services.msc > rightclick MySQL > properties >start
answered Jul 6, 2016 at 21:17
0
I got this error when I ran out of space on my drive.
answered Jul 1, 2016 at 15:02
MDaveMDave
1,20513 silver badges29 bronze badges
Go to Run type services.msc.
Check whether or not MySQL services are running. If not, start it manually. Once it is started, type MySQL Show
to test the service.
answered Aug 24, 2017 at 6:12
To connect locally to MySql
, you do not have to setup a firewall with inbound rules. But, even if you already setup iptables
to allow the TCP
inbound port 3306 and grant the privilege to the user to access the db locally, you may have to setup the bind address in your my.cnf
file, edit the default address there and put the server IP address that is running the MySql
service.
Brian
5,0597 gold badges36 silver badges47 bronze badges
answered Aug 16, 2013 at 19:46
0
Since I have struggled and found a slightly different answer here it is:
I recently switched the local (intranet) server at my new workplace. Installed a LAMP; Debian, Apache, MySql, PHP. The users at work connect the server by using the hostname, lets call it «intaserv». I set up everything, got it working but could not connect my MySql remotely whatever I did.
I found my answer after endless tries though. You can only have one bind-address and it cannot be hostname, in my case «intranet».
It has to be an IP-address in eg. «bind-address=192.168.0.50».
answered Jan 28, 2016 at 8:34
run > services.msc > rightclick MySQL57 > properties >set start type option to automatic
after restarting computer
At cmd
cd: C:
C :> cd "C:Program FilesMySQLMySQL Server 5.7bin"
it will become
C:Program FilesMySQLMySQL Server 5.7bin>
type mysql -u root -p
ie C:Program FilesMySQLMySQL Server 5.7bin> mysql -u root -p
Enter password: ****
That’s all
It will result in
mysql>
Phiter
14.5k14 gold badges50 silver badges84 bronze badges
answered Mar 9, 2016 at 14:22
Another possibility:
There are two ways the MySQL client can connect to the server: over TCP/IP, or using sockets. It’s possible you have your MySQL server configured to support socket connections, but not network connections.
answered Sep 23, 2008 at 4:49
dj_segfaultdj_segfault
11.9k4 gold badges29 silver badges37 bronze badges
1
Nothing to do just «Reset to Default» your firewall setting it will start working.
I read many solutions but nothing worked properly, so at last I reset firewall settings which worked.
answered Apr 17, 2013 at 8:13
1
finally solved this.. try running mysql in xammp. The check box of mysql in xammp should be unclicked. then start it. after that you can open now mysql and it will now connect to the localhost
answered Dec 15, 2013 at 3:42
1
Edit your ‘my-default.ini’ file (by default it comes with commented properties)as below ie.
basedir=D:/D_Drive/mysql-5.6.20-win32
datadir=D:/D_Drive/mysql-5.6.20-win32/data
port=8888
There is very good article present that dictates commands to create user, browse tables etc ie.
http://www.ntu.edu.sg/home/ehchua/programming/sql/MySQL_HowTo.html#zz-3.1
answered Aug 6, 2014 at 13:53
hmehandihmehandi
3464 silver badges11 bronze badges
- Right click on My Computer
- Click on Manage
- Go to Services and Application
- Select Services and find MySQL service
- Right click on MySQL and select Start
answered Aug 11, 2016 at 7:28
Ive install wamp server on my PC(it has no internet or intranet connection, Windows XP -OS).
But when I access MYSQL this error popup.
Can you give any idea on how can i resolve this error.
thank you very much.
Cant connect to MYSQL server on ‘localhost’ (10061)
OMG Ponies
324k80 gold badges520 silver badges499 bronze badges
asked Dec 22, 2008 at 1:12
from the commandline (start/run/ type cmd, press ok), type:
telnet localhost 3306
If MySQL is running, you’ll see the mysql version (and some garbage).
To see if the service is running, type:
sc query mysql
You’ll see something like this if it’s running:
SERVICE_NAME: mysql
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE,PAUSABLE,ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
answered Dec 22, 2008 at 3:07
To check to see if MySQL is running, provided its installed as a service you can go to Start -> Control Panel -> Administrative Tools -> Services (i may be a bit off on those paths, I’m an OS X / Linux user), and look for MySQL on that list. See if it is started or stopped.
You can then do a portscan if you really want to and determine if that port is open. There are all kinds of free tools online that will scan your IP and tell you which ports are open and what is listening on them.
answered Dec 22, 2008 at 2:56
Unless you did something during the install, I believe that the port will be standard and the service will NOT be running after install.
MySQL provides several GUI tools for managing servers: http://dev.mysql.com/downloads/gui-tools/5.0.html One of those tools is the «MySQL System Tray Monitor» which will detect the running service, and allow you to stop and start the server easily. You can also review the list of services for «MySQL» to see if that service is active.
If the service is running and you still can’t connect, you need to make sure the Windows firewall is not blocking access to the port. If your firewall is not configured to notify you when it block a program (check the Windows Firewall control panel, it might not have notified you that it’s detected the program).
answered Dec 22, 2008 at 3:05
acrosmanacrosman
12.8k10 gold badges39 silver badges55 bronze badges
Make sure it is running, check in my.cnf that it is really listening to the correct IP ( 127.0.0.1 ) and make sure you connect to the correct port aswell.
Try using telnet for debugging aswell and see where the problem lies, maybe mysql isnt started, or listens to a different port.
answered Dec 22, 2008 at 1:14
Filip EkbergFilip Ekberg
36k20 gold badges126 silver badges183 bronze badges
try to change a mysql port 3300 to «3306»
answered Dec 19, 2018 at 11:48
0
When you’re done installing a MySQL server application on Windows operating system, you can try to login to your MySQL server by using the mysql
command from the Command Line.
But sometimes you may get the MySQL 2003
error saying it can’t connect to MySQL server as shown below:
mysql --user=[your username] --password=[your password]
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost:3306' (10061)
The error above means that your request to connect to the MySQL server has been refused.
There are two things you need to check to fix this error:
- Make sure that your MySQL service is actually running
- Check that you are attempting to connect to the right port number
This tutorial will help you to do both, starting with checking MySQL service status.
Make sure that your MySQL service is actually running
To fix this error, you need to make sure that your MySQL server service is actually running in the Services
panel.
First, open the Windows Start menu and search for the Services
panel to see the result below:
Then, scroll through the services list until you reach the services that start with "M"
to look for MySQL
services.
Usually, you have the MySQL version number attached to the service name.
The MySQL version installed on my computer is MySQL 8.0.26
so I have MySQL80
service listed as shown below:
If you have MySQL version 7, then you may have MySQL70
listed on the Services panel.
As you can see from the picture above, the status of MySQL80
service is empty, meaning that it’s not currently running.
If you see the same status, you can run the service by clicking the Start
the service link on the left pane.
Now you can try to connect again to your MySQL server from the Command Line.
MySQL service is missing from the Services panel
If you don’t find MySQL service from the Services panel, then you may not have installed MySQL as a Windows service.
It’s always recommended to install MySQL as a Windows service so that you can start and stop a running MySQL program easily.
To install the MySQL service, you can run the mysqld --install
command from the command line as follows:
mysqld --install
Service successfully installed.
Please note that you need to have Administrator access to perform the installation above.
Alternatively, you can re-run the MySQL installer program and choose to reconfigure the installed MySQL server as shown below:
In the reconfigure wizard panel, click on Next until you get into the Windows Service section.
You should check the box that says Configure MySQL Server as a Windows Service
as follows:
When you’re done, click on Next and then click on Execute to run the changes.
Now you should be able to find MySQL under the Services
panel.
Check that you are attempting to connect to the right port number
When you run a MySQL service on your computer, the service will start MySQL server and allows you to connect to the server under a specific port
number.
By default MySQL uses port 3306
but you can check the one you are currently using in your my.ini
file.
The my.ini
file is a MySQL configuration file used to properly configure the running MySQL services.
When you install MySQL using the official installer, then you should have a my.ini
file located under your MySQL installation folder.
For example, mine was located under C:ProgramDataMySQLMySQL Server 8.0
folder as shown below:
Once you find the file, open it and find the [client]
section.
You should find the port
number assigned under the section as shown below:
[client]
# pipe=
# socket=MYSQL
port=3306
[mysql]
no-beep
Once you find the port number, and the number to the mysql
command when you try to login as follows:
mysql --user=[your username] --password=[your password] --port=3306
Now you should be able to connect to your local MySQL server. Nice work! 👍
When you are working with a MySQL database, you might run into this error:
2003 - Can't connect to MySQL server on '127.0.0.1' (or some other host)
There might be several causes for that error, so you can try these methods to find out what the problem is.
1. Check for typos
A small typo in the MySQL server name, database name, username, port, etc. can lead to this error, so make sure you got them right 100%.
2. Make sure MySQL server is running
Maybe the problem is that there is no MySQL server running at the specified host. So the first thing you should do is to verify the status of MySQL Server. It’s recommended to try restarting the MySQL server.
You might need to check the port that it’s listening to, the default port is 3306.
If you are using DBngin to manage the local server, launch DBngin and see if the server is still on. If not, start it.
3. Connection to the MySQL server is not allowed using TCP/IP
You need to make sure that your MySQL server was not started with the --skip-networking
option. You should find the setting in the MySQL configuration file (my.ini on Windows, my.cnf on Unix/Linux).
If it was, remove it and restart MySQL server for the change to take effect.
For remote connections, you need to confirm that MySQL remote access is enabled. By default, MySQL listens for connections only from localhost. Go check the MySQL configuration file and give the bind-address
as the IP address of the server where MySQL service listens.
You could also try increasing the max_connection
parameter in the MySQL configuration file.
4. There is a networking issue blocking access to MySQL
It could be a network firewall blocking the connection. Most often it will help to uninstall and reinstall the firewall.
5. Still no help at all?
If you tried all above and none of them worked, try connecting using SSH Tunnelling instead and see if it helps.
For more information, visit MySQL Reference Manual.
Need a good MySQL GUI? TablePlus provides a native client that allows you to access and manage MySQL and many other databases simultaneously using an intuitive and powerful graphical interface.
Download TablePlus for Mac.
Not on Mac? Download TablePlus for Windows.
Need a quick edit on the go? Download for iOS