Reputation: 767
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.
Upvotes: 10
Views: 83020
Reputation: 1
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}
Upvotes: 0
Reputation: 29
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
Upvotes: -1
Reputation: 111
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.
Upvotes: 0
Reputation: 5543
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
Upvotes: 0
Reputation: 1
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 -pwhere C:\Program Files (x86)\MySQL\MySQL Server 5.0\ is your installation directory and my.ini is configuration file.
Upvotes: 0
Reputation: 41
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.
Now start the MYSQL services and try to configure the same.
Upvotes: 4
Reputation: 9576
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.
Upvotes: 0
Reputation: 77
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
Upvotes: 0
Reputation: 712
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.
Upvotes: 7
Reputation: 767
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.
Upvotes: 5