Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error 2003: Can't connect to MySQL server on 'localhost' (10061)

I'm trying to learn MySQL, so I downloaded MySQL v5.5 for windows 7 and chose the Developer settings. I open a command prompt, enter

mysql -u root -p

and get the following: error

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

How do i fix this? I type:

sc query mysql

and get:

STATE: 1 STOPPED

I try:

 sc start mysql

and get:

[SC] StartService: OpenService FAILED 5: Access is Denied.

I also checked: Control Panel:Administrative Tools:Services

MySQL55 is started, but MySQL is stopped. MySQL is looking the MySQL Server 5.1 folder, so I'm not sure why I would need it, but when I try to start it, I get:

"Windows could not start the MySQL Service on Local Computer. Error 2: They system cannot find the file specified".

Thanks.

like image 989
user1106278 Avatar asked Dec 19 '11 18:12

user1106278


People also ask

Can't connect to server on localhost 10061?

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.

Can't connect to MySQL server on localhost 3306 10061 No connection could be made because the target machine actively refused it?

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.

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.


3 Answers

Check if MYSQL service is installed in services.msc In case not, go to services.msc & check if windows firewall is up. if yes, stop it.

  1. open cmd as an administrator and go to bin folder of your MYSQL installation.
  2. type mysqld --install. It will successfully install service.

Now start the MYSQL services and try to configure the same.

like image 162
Aryan Avatar answered Nov 05 '22 20:11

Aryan


For the other newbie people who have the same problem as me (windows 7 64 bit):

Early versions of the MySQL installer does not set up the windows service at all (David Newcomb). I have spent 2 days googling and faced a lot of confusing answers that did not worked for me, then I found the following solution:

net start mysql

,when the service is installed you should be able to enter the above command to start the service. my version of mysql is 5.6 (the newest one up to know), so you do not have to install the old versions as it is suggested.

See MySQL Error 2003: Can't connect to MySQL server on 'localhost' ,thank to @David Newcomb response.

like image 37
Ehsan Masoudi Avatar answered Nov 05 '22 20:11

Ehsan Masoudi


I couldn't call mysql from the command prompt after about 15 hours of effort, so I quit. Instead, I installed version 4.1.22. If you go to mysql main webpage, you won't find 4.1.22 in the archive. Instead, I searched for mysql 4.1 in google. Hopefully they haven't removed it when you try it.

I downloaded the "Essentials Package" and chose the "typical install" option. I then went to Start -> MySQL ... MySQL Server Instance Config Wizard and chose "Install as Windows Service" and "Include Bin Directory". There's a drop down box where I could choose the name, like "MySQL" or something else. It complained when I chose "MySQL", saying that I already had an installation. I changed it, then it installed. From there, I could call "mysql" from the command line.

If you can't find v4.1 or want to use v5, something along the lines of:

http://www.devside.net/guides/windows/mysql

may work with modification, but it didn't work after following their instructions, with the exception of using version 5.5 instead of v5.1.

Good luck.

like image 32
user1106278 Avatar answered Nov 05 '22 21:11

user1106278