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,8238 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
74.9k17 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,83430 silver badges44 bronze badges
answered Sep 23, 2008 at 3:58
ChrisChris
4,8221 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
3364 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 installed MySQL using mysql-installer-5.5.20.0.msi on Windows 7.
From the cmd window, I run «mysqlshow -u root -p». It asked for a password, then returned this error: «Can’t connect to MySQL server on ‘localhost’ (10061)» This is a bad indication of partially failed/successful installation.
After reading the page, http://dev.mysql.com/doc/refman/5.5/en/windows-troubleshooting.html, it told me to find an error log (.err) in C:Program FilesMySQLMySQL Server 5.5data. The directory exists but there is no log file.
I have a feeling this is related to the tight security of Windows 7, especially when installing a Unix based software. And yes, I am the Administrator on my PC.
Any help or suggestions is appreciated. And I can return a favor by answering Java and SQL query questions.
asked Jun 5, 2012 at 6:31
12
Please Try the following steps:
- c:mysqlbin>mysqld —install
- c:mysqlbin>mysqld —initialize
then press «Windows key + R» write «services.msc«, run as admin
start MySQL service.
K. Yen
1932 silver badges14 bronze badges
answered Jan 19, 2016 at 7:21
5
I also faced the same issue and resolved it by below setups:
-
Check the MYSQL service in the windows service. If it is there and not running then start it. It will solve your problem.
You can find the services window by navigating to windows Start menu and typing ‘services’ in the search bar. Select the ‘Services’ option with the cogs next to it (not the executable file) and the below window will appear. Scroll down to find ‘MySql (version)’. When you select MySql you should see an option in the left pane that says ‘Start the service’. Click this and a dialogue should appear to indicate Windows is attempting to start the service. Once started the left pane will now give you the option to stop, pause and restart the service and you will now be able to connect to your MySql from the windows cmd line.
-
If MYSQL service is not present in windows service then follow below setups.
a. Open cmd as administrator.
b. cd to C:Program Files (x86)MySQLMySQL Server 5.6bin
c. Run the command:
C:Program Files (x86)MySQLMySQL Server 5.6bin>mysqld.exe —installd. Check the MySql in the windows service, And if it is not running, Start it by clicking on the service.
e. If your using XAMMP . Start MySQL at the XAMMP control Panel.
answered Apr 29, 2017 at 13:23
5
this issue is very to solve by windows server users
-
go to this path
C:Program FilesMySQLMySQL Server 5.1bin -
run this tool «MySQLInstanceConfig.exe»
and config the instatnce again and problem solved
answered Nov 18, 2013 at 9:05
shay lamishay lami
3943 silver badges2 bronze badges
4
The simple solution that worked for me is: change localhost to 127.0.0.1 in your database.yml or in your script if writing one.
doubleDown
7,9881 gold badge32 silver badges48 bronze badges
answered Oct 27, 2012 at 3:16
KeramatKeramat
1211 silver badge3 bronze badges
1
Here, you need to make sure that the MySQL service is running is Windows. It might be possible that your MySQL service is not running cuurrently.
- Open Services window by pressing
Windows+Rand enteringservices.msc - Find out
MySQLright click and selectstart.
It works.
7bStan
1601 gold badge4 silver badges13 bronze badges
answered Apr 11, 2020 at 8:16
1
I had this error — stupid mistake was, I was using -p3307 to specify port, whereas I should have used -P3307, i.e. capital P. Small ‘p’ is for password arg 
answered Aug 26, 2014 at 13:15
In Windows 7
- press Windows+R it opens Run
- Enter services.msc
- Find out mysql right click and start
- if mysql was not found
- Run cmd as administrator
- goto C:Program Files (x86)MySQLMySQL Server 5.6bin directory(to go back use cd..) and type
mysqld.exe --install
- follow step 3
That’s all
barbsan
3,41811 gold badges21 silver badges28 bronze badges
answered Jun 10, 2017 at 18:13
nikhilnikhil
811 silver badge1 bronze badge
2
I solved this by adding the following arguments to the command line string:
mysql --user username --password password --host localhost --port 3306 databasename < "system path to .sql file"
Without the --host and --port arguments, especially if you change the port to let’s say 3307, which is a non default value, will cause this error.
barbsan
3,41811 gold badges21 silver badges28 bronze badges
answered Jan 14, 2018 at 9:59
2
I got this error in command prompt when I tried to open MySQL from cmd «mysql -u root -p»
Can’t connect to MySQL server on ‘localhost:3306’ (10061)
It was because I changed my port during the installation of MySQL community server as I had XAMPP server installed and running as well which was not allowing me to use the port 3306.
So basically I had 2 MySQL servers installed in my system.
- MySQL community server.
- XAMPP server.
If anyone had this same issue this is how I fixed it.
Step 1: Reconfigure MySQL server to port 3306
Step 2: Reconfigure XAMPP to use a different port other than 3306
Note: Stop the XAMPP server before following the steps.
Step 1: Reconfigure MySQL server to port 3306
- Click Start and open MySql installer — community
- Click on reconfigure button in front of MySql server
- Type 3306 in port. Execute and complete the installation.
Step 2: Reconfigure XAMPP to use a different port other than 3306
- Open XAMPP and change the port other than 3306 in two files
my.ini under MySQL
and php.ini under Apache
Now everything seems to be working fine for me. I was able to get into MySQL community server from cmd and I can use XAMPP server as well.
Dharman♦
30.4k22 gold badges84 silver badges133 bronze badges
answered Aug 11, 2021 at 15:16
mrsagar105mrsagar105
1762 silver badges6 bronze badges
I have Windows 8.1 and I too had this problem. My teacher told me it was probably because my MySQL server had stopped running. She told me to go into the Computer Management utility (right click the lower-most left hand corner of the screen on Windows 8.1 to access Computer Management). Then under Services and Applications, open up the Services and find MySQL. You should be able to right-click on MySQL and restart it.
answered Jan 26, 2015 at 7:04
AvilioAvilio
5716 silver badges4 bronze badges
-
In Start Menu, search for «mysql». Among the results, you should see the «MySQL Installer — Community». Run it.
-
MySQL Installer window will show up as shown below. Find «MySQL Server» under Product and click on «Reconfigure» link.
-
The MySQL Installer will show up (same one you used for the first MySQL Server installation). Go through all the steps.
-
After the MySQL Installer was finished, I started the MySQL service again. This time, the «Startup Message Log» on The MySQL Notifier was showing that the server started successfully:
MySQL : How to fix Can’t connect to MySQL server on localhost 10061 error
answered Aug 30, 2018 at 15:30
This is the easiest solution and worked for me.
- Go to where you downloaded
«mysql-installer-web-community-8.0.19.0.msi», file for installing
mysql. - Run this by double clicking on it. (No need to uninstall anything)
- Click on «reconfigure» beside the MySql server.
- Agree everything which comes in middle, provide password for root where asked.
- Finish. That’s it you’re good to go.
answered May 19, 2020 at 6:11
2
For the 5.7 version, I had the same problem and a simple fix did the trick. As Installed the workbench 5.7 there was another «software» of sorts called the «MySQL Installer Community». I ran this and ran the «Reconfigure» for the MySQL server. It took about a minute and the problem was no longer there.
Hope it works!.(Keep in mind i was using the 5.7 version)
answered Feb 27, 2017 at 22:08
user0221441user0221441
3684 silver badges11 bronze badges
Just turn off the firewall and remove the instance configuration. Add a new instance for the server.![Disable Firewall][1]
Give he port number correctly as 3306 as default
answered Jul 25, 2013 at 17:41
Solution 1:
For 32bit:
Run «mysql.exe» from: C:Program FilesMySQLMySQL Server 5.6bin
For 64bit:
Run «MySQLInstanceConfig.exe» from: C:Program FilesMySQLMySQL Server 5.6bin
Solution 2:
The error (2002) Can’t connect to … normally means that there is no
MySQL server running on the system or that you are using an incorrect
Unix socket file name or TCP/IP port number when trying to connect to
the server. You should also check that the TCP/IP port you are using
has not been blocked by a firewall or port blocking service.The error (2003) Can’t connect to MySQL server on ‘server’ (10061)
indicates that the network connection has been refused. You should
check that there is a MySQL server running, that it has network
connections enabled, and that the network port you specified is the
one configured on the server.
Source: http://dev.mysql.com/doc/refman/5.6/en/starting-server.html
Visit it for more information.
answered Nov 12, 2014 at 17:35
1
I had the same error. I resolved in this way
Go to start- MySQL Installer-community and run again the installer as a re-configuration(you will be asked so).
Once asked if you want make MySQL instance to run as a Windows service, check the box.
In case would do not work, try unistalling and installing again, and check the box to run MySQL as Windows service.
answered Jun 8, 2016 at 16:28
3
From what I’ve gathered this means the mysql service (mysqld) isn’t running.
- First make sure it is installed as a windows service : Run
"C:Program FilesMySQLMySQL Server 5.5binmysqld" --install
from the command line.
- Next, start it up :
services.msc > MySQL > start
If it fails to restart, then you can follow these steps :
- open the command line as an administrator :
cmd.exe > open as administrator - run
"C:Program FilesMySQLMySQL Server 5.7binmysqld" --verbose
it should fail and put the error log in a directory named data under C:Program FilesMySQLMysSQL Server 5.7 . If it fails to create data for some reason, do it manually under that directory and try again. If you can figure out what’s missing from what’s in that log, then good, you’re done.
If you’ve still got no luck, this is how I did it :
-
goto
C:ProgramDataMySQLand copy the file named my.ini toC:Windows -
try to start the service again from the command line :
"C:Program FilesMySQLMySQL Server 5.7binmysqld" --verbose
If it doesn’t display any error, than the service startup was successfull. If it’s still not working, than delete that my.ini you just copied from C:Windows and start the service from the command line once again.
it should work now
answered Oct 31, 2016 at 18:37
Paul MiraPaul Mira
711 silver badge3 bronze badges
if it is showing error 2003 (HY000): Can’t connect to MySQL server on localhost (10061) than
- Search services.msc in run
- goto mysql properties
- copy the mysql service name
- start cmd as administrator
- write: net start mysqlservicename .i.e mysql57 or etc it will show mysql is starting.
answered Apr 7, 2017 at 8:31
For me, three steps solved this problem on windows 10:
I downloaded MySQL server community edition zip and extracted it in the D drive. After that I went to bin folder and did cmd on that folder. I followed the below steps and all works:
D:toolsmysql-8.0.17-winx64bin>mysqld -install
Service successfully installed.
D:toolsmysql-8.0.17-winx64bin>mysqld --initialize
D:toolsmysql-8.0.17-winx64bin>net start mysql
The MySQL service is starting...
The MySQL service was started successfully.
Kevin
16.2k8 gold badges57 silver badges74 bronze badges
answered Aug 20, 2019 at 11:46
I too had this problem, its easy to solve:
Go to Control panel — System and maintenance — System — Advanced system settings — Environment variables — System variables — path — click edit — add
"c:xamppmysqlbin" — it should look like this :
Program Files (x86)NVIDIA CorporationPhysXCommon;C:Program Files (x86)InteliCLS Client;C:Program FilesInteliCLS Client;%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;%SYSTEMROOT%System32WindowsPowerShellv1.0;C:Program FilesIntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine ComponentsIPT;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsIPT;C:Program Files (x86)IntelOpenCL SDK2.0binx86;C:Program Files (x86)IntelOpenCL SDK2.0binx64;C:Program Files (x86)Windows LiveShared;C:Program Files (x86)QuickTime AlternativeQTSystem;c:xamppmysqlbin
And don’t forget to start MySQL from control panel of Xampp.
answered Jun 3, 2013 at 8:31
Siddharth PatelSiddharth Patel
1931 gold badge2 silver badges15 bronze badges
1
I found the same error re occurring even after I tried all the above solutions given above. I had even tried version 5.7 and few more. Guys don’t waste your time trying to fix it. Rather install version 5.5. It’s working perfectly fine without any unnecessary error.
answered Jul 1, 2018 at 16:48
Well in my case I just opened services.msc using run and restarted 2 of the services related to mysql and it worked!
answered Sep 21, 2018 at 7:28
In case of Xampp Installation.
Go to your xampp installation and mysql folder, for my case: C:xamppmysql
Run the file «resetroot.bat» from cmd or explorer.
My installation started working!!!
answered Nov 23, 2018 at 8:52
The solution that fixed the issue was using the following steps:
In Start Menu, search for «mysql». Among the results, you should see the «MySQL Installer — Community». Run it.
MySQL Installer window will show up as shown below. Find «MySQL Server» under Product and click on «Reconfigure» link.
MySQL Installer Community
The MySQL Installer will show up (same one you used for the first MySQL Server installation). Go through all the steps.
After the MySQL Installer was finished, I started the MySQL service again.
answered Dec 16, 2018 at 16:49
Don’t do useless stuff like reconfigure, stop MySQL and start MySQL in service.
Just reinstall the MYSQL server and again install it in your system.
Remember only uninstall MySQL server and nothing else.
All the problem will be solve automatically
answered Aug 6, 2019 at 16:32
The main reason for this kind of error is you might have uninstalled Mysql server application. Install it and then give it a go.
answered Aug 26, 2019 at 9:28
I had the same issue and basically resolved it by pointing to a specific port number that my MySQL server was running on. Below is the command. Please edit the code to fit your case i.e your port number,your mysql server username,your password.
mysql -u root -pYourMysqlRootPassword -P3307
answered Oct 11, 2019 at 11:35
Tom MunyiriTom Munyiri
1562 silver badges5 bronze badges
- Create the temp folder c:/mysqltmp
- In my.ini file under [mysqld] add the line
tmpdir=c:/mysqltmp - Add full privileges to user NETWORK SERVICE for «C:ProgramDataMySQLMySQL Server X.YDataibdata1″ file
- Start service
These are steps for the same problem with MySQL5.7 and MySQL8.0 on Windows 10
answered Oct 11, 2019 at 21:03
#1 13.01.2010 16:16:20
- TrixX
- Участник
- Зарегистрирован: 13.01.2010
- Сообщений: 3
10061 ошибка при подключении к базе.
10061 ошибка возникает из-за того что MySql не слушает порт. Но какой именно? как узнать какой порт нужен чтоб открыть его? и если есть другие способы как подключится удаленно скажите пожалуйста.
Неактивен
#2 13.01.2010 16:58:32
- paulus
- Администратор
- Зарегистрирован: 22.01.2007
- Сообщений: 6753
Re: 10061 ошибка при подключении к базе.
Порт 3306. Удаленно подключиться можно только по tcp/ip.
Причин может быть несколько:
1. Не запущена служба MySQL;
2. Брэндмауэр блокирует этот порт от внешних соединений;
3. MySQL не слушает порт, потому что в нем запрещены соединения
по сети (skip-networking в my.ini);
4. MySQL не слушает внешний интерфейс (bind-address в my.ini).
Неактивен
#3 15.01.2010 14:46:10
- TrixX
- Участник
- Зарегистрирован: 13.01.2010
- Сообщений: 3
Re: 10061 ошибка при подключении к базе.
чтоб появился my.ini устанавливаем VentrigoServ там будут эти настройки. Пока не пробовал,как попробую если поможет отпишусь. Заранее спасибо админу)
Отредактированно TrixX (15.01.2010 14:48:47)
Неактивен
#4 15.01.2010 15:01:37
- paulus
- Администратор
- Зарегистрирован: 22.01.2007
- Сообщений: 6753
Re: 10061 ошибка при подключении к базе.
Интересно, чем Вам стандартный инсталятор не угодил
Неактивен
#5 15.01.2010 17:37:31
- TrixX
- Участник
- Зарегистрирован: 13.01.2010
- Сообщений: 3
Re: 10061 ошибка при подключении к базе.
my.cnf файл в mysql там просто бинд айпи убрал. спасибо Администратору) все пашет, ошибка 10061 устранена. Ура
Неактивен
#6 11.03.2011 21:32:02
- Ася
- Участник
- Зарегистрирован: 11.03.2011
- Сообщений: 1
Re: 10061 ошибка при подключении к базе.
помогите, дает ошибку 10061 причем попробовала загрузить ранее сказаный VentrigoServ не помогло
Неактивен
#7 16.03.2011 21:13:45
- paulus
- Администратор
- Зарегистрирован: 22.01.2007
- Сообщений: 6753
Re: 10061 ошибка при подключении к базе.
Если Вы делаете то же самое, то сделайте то же самое. Если нет — опишите
проблему
Неактивен
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






