0

I recently downloaded mysql-5.7.9-winx64.zip and tried to run mysqld from command line but it does not starts gives me following error.

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

I have updated system path variable to have "D:\MySQL\mysql-5.7.9-winx64\bin" and added mysql as system service

"D:\MySQL\mysql-5.7.9-winx64\bin" --install

It's still does not start when I restart my system.

Also when I tries to run from services.msc ==> MySQL ==> Start It gives me following error:

MySQL Services on Local Computer started and then stopped. Some services stops automatically if they are not in use by other service or programs.
3
  • it gives me error : mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to MySQL server on 'localhost' (10061)' Check that mysqld is running on localhost and that the port is 3306. You can check this by doing 'telnet localhost 3306' Commented Nov 24, 2015 at 7:42
  • Yes on task manager its shows MySQL status stopped when I tries to start it gives same error Commented Nov 24, 2015 at 7:44
  • This question is sufficiently vague to not have one upvote in 6 years. Moreover, not a single answer on it has an upvote .It's just poisoning the search and providing no value. Commented Oct 30, 2021 at 20:16

6 Answers 6

1

If it not mistake in original question:

"D:\MySQL\mysql-5.7.9-winx64\bin" --install

this is not working command, it is only path with parameters, but no executable file

did You also edit my.ini?

try to run command

>sc qc "You Service Name"

correct result must be like this:

C:\Users\Vladimir>sc qc mysql57
[SC] QueryServiceConfig SUCCESS

SERVICE_NAME: mysql57
        TYPE               : 10  WIN32_OWN_PROCESS
        START_TYPE         : 2   AUTO_START
        ERROR_CONTROL      : 1   NORMAL
        BINARY_PATH_NAME   : "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL S
erver 5.7\my.ini" MySQL57
        LOAD_ORDER_GROUP   :
        TAG                : 0
        DISPLAY_NAME       : MySQL57
        DEPENDENCIES       :
        SERVICE_START_NAME : NT AUTHORITY\NetworkService

C:\Users\Vladimir>

next string is important and must be used by You if You want manually install or edit service

"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" MySQL57

If You need MySQL 5.7 and not sure with command line - just use installer from Oracle, it do all for You. If version not very important - as suggested use XAMP, most of them use MySQL 5.5

2
  • ohh sorry that was typo mistake ""D:\MySQL\mysql-5.7.9-winx64\bin\mysqld" --install" Commented Nov 25, 2015 at 5:48
  • For now I have downloaded older version 5.7.4 its working fine for me. I have not edited my.ini file Commented Nov 25, 2015 at 5:53
1

Connecting from the localhost shouldn't be an issue, but edit your "C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" file and change the bind-adress from 127.0.0.1 to the external IP address. Also, set mysql skip-networking to off. Finally, set a rule on windows firewall to allow connections on port 3306.

0

I had the same problem to solve. Here was my setup: Windows 10 and MySQL 8, it doesn't matter at all I guess.

Solution: in the opts file, whatever you specify, in my case, it was my-opts.cnf, set this:

[mysqld]
datadir=D:\\dbms\\data\\mysql

then try to use

mysqld --install MYSQL --defaults-file=D:\dbms\data\mysql-opts\my-opts.cnf

check the status (run as Administrator)

sc query MYSQL
-1

I had an issue where the mySQL 8 service wouldn't start, and I didn't see my fix for the issue here in this thread. It ended up being a corrupt my.ini with some random HEX characters in it. The simple solution for me was to remove the HEX characters then restart the service. I wrote up a detailed walkthrough in the link below if you're not sure how to edit HEX characters out of a file. I used Notepad++

https://madbray.com/mysql80-service-started-and-then-stopped-fixed/

-2

My findings with v 5.7.12.0...

The brain-dead installer needs help with adding entries to my.ini.

Firstly, it failed to add a correctly formatted path for the 'datadir' parameter, as in it didn't quote the path which had spaces in and it mixed forward and backslashes.

Secondly, it mangled the path for the logs that I'd entered, turning what I'd browsed for - note: "browsed for", not "typed"!! - which was

"C:/ProgramData/MySQL/Logs/[machine_name]_General.log" to "C:/ProgramData/MySQL/MySQL/Lgs/[machine_name]_General.log".

Other log entries also had to have their paths quoted.

Once these were corrected, the service started.

-4

Goto "services.msc" from the run dialog. Then search for the MySQL server and try starting the server manually.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.