10

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.

Dhanuka
  • 2,826
  • 5
  • 27
  • 38
user1106278
  • 747
  • 1
  • 9
  • 18

10 Answers10

7

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.

Community
  • 1
  • 1
Ehsan Masoudi
  • 712
  • 10
  • 19
5

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.

user1106278
  • 747
  • 1
  • 9
  • 18
  • Congrats on the solution. When you can, make sure you mark your answer as "Accepted" so that others might learn from your success. Cheers~ – Andrew Kozak Dec 21 '11 at 18:01
  • Thanks, Andrew. As I understood it, if you want to call mysql from command line in v5.5, you need one computer for a server and another to connect to it. The above solution avoids the need for two computers. There's probably an easier way if anyone wants to post it. – user1106278 Dec 22 '11 at 01:22
  • Thanks for the answer. I had the exact same problem. Tried your suggestion and downloaded the v4.1.22 from this link "http://downloads.skysql.com/archive/index/p/mysql/v/4.1.22" - "Server Essentials Intel/AMD x86 32 bit Installer". After installing the v4, it works fine. – Lynn Nov 30 '12 at 03:50
4

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.

Rao
  • 20,781
  • 11
  • 57
  • 77
Aryan
  • 41
  • 1
0

Start MySql service from Control panel.

Enabling MySql service in windows 7 Control Panel\All Control Panel Items\Administrative Tools Open "Services" then enable MySql service
From command prompt mysql -u root -p mysql and enter the password as admin, which is the default password

This will work

Sankar R.K
  • 77
  • 2
  • 10
0

Go to Run type services.msc. Check whether MySQL services is running or not. If not, start it manually. Once it started, type mysqlshow to test the service.

Thirumal
  • 8,280
  • 11
  • 53
  • 103
0

open cmd in admin mode and type

cd C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin\
mysql --defaults-file="C:\Program Files (x86)\MySQL\MySQL Server 5.0\my.bin" -u root -p 
where C:\Program Files (x86)\MySQL\MySQL Server 5.0\ is your installation directory and my.ini is configuration file.
  • 1
    I think the OP's mysql service is not running. – Rohit Agre Aug 11 '16 at 10:56
  • The error msg say this but Originally if you do not add the configuration file( my.ini ) that is if you do not tell the client program what is the name of the server service ! then it is common that the mysql client program show you an error that may also be "mysql service is not running" . So if you find the mysql service is running in service manager though showing 'mysql service is not running' error then it is definitely that it is for the configuration file. OK – Subhajit Sarkar Aug 11 '16 at 13:44
0

In windows 10, I faced similar issue and above commands didn't work for me.

But when I started service from the taskbar option didn't knew there was taskbar item to do so.

Adding a screenshot to show where exactly it appears enter image description here

Napolean
  • 5,303
  • 2
  • 29
  • 35
0

By far the easiest way to get your mysql server installed and configured is to download and use the 'MySQL Installer', which should solve your problem.

Avinav K
  • 111
  • 1
  • 3
0

here are a few steps which you have to follow which work in my case:

step1: open cmd with dir as C:\mysql\bin

step 2: type C:\mysql\bin>mysqld --console hit Enter

step 3: again open cmd with dir C:\mysql\bin>

step 4: type command: C:\mysql\bin>mysql -u root -p enter password : ****(whatever your password) hit Enter

step 5 : you can be able to see mysql> {write your mysql queries here}

mario
  • 9,858
  • 1
  • 26
  • 42
-1

The first thing you need to check is whether the service is running or not.

If not start the mysql service.

To start the MySQL service:

In Windows 10 Press Windows key ,type services open as Administrator and right click on that mysql service to start.

Check the port number if not default 3306 ,then need to mention

like mysql -u root -ppassword --port=3307 referred this link. http://dba.fyicenter.com/faq/mysql/Connect-to-MySQL-on-Specific-Port.html

Priya
  • 29
  • 2
  • 8