Changil Lee
Changil Lee

Reputation: 157

After install, mySQL doesn' start (windows10, source install)

I'm installing Apache server, php, and MySQL on Windows10. First two was successful but MySQL has a problem.

I installed MySQL into C:\mysql-5.7.10-winx64, and changed my.ini like this

basedir = C:/mysql-5.7.10-winx64
datadir = C:/mysql-5.7.10-winx64/data
port = 3306

I succeeded install but if I try to start, it shows like below

C:\Windows\system32>net start mysql
The MySQL service is starting.
The MySQL service could not be started.
The service did not report an error.
More help is available by typing NET HELPMSG 3534.

However, if I check Computer Management>Event Viewer>Custom Views>Summary page events, it tells me "failed to set datadir to C:\mysql-5.7.10-winx64\data\"

Error Event Description

If I make data folder manually, error message changed to

Can't open the mysql.plugin table

Please run mysql_upgrade to create it.." and some files are created in data folder

enter image description here

I tried to upgrade by typing mysql_upgrade but it failed.

mysql_upgrade: Got error: 2003: Can't connect to MySQL server on 'localhost' (10061) while connecting to the MySQL server. Upgrade process encountered error and will not continue.

How can I solve this issue?

Upvotes: 10

Views: 25748

Answers (10)

michail.samolo
michail.samolo

Reputation: 66

Looks like my solution is not added yet,

I've installed mysql80 , edited my.ini in windows notepad and got the same error like topic author "... NET HELPMSG 3534." when I start mysql service,

and my issue was in extra bytes added by notepad at the begining (EB BB BF) on my.ini, when I edited (added the same changes) my.ini in other editor everything worked fine.

enter image description here

Upvotes: 0

Jayani Nadeesha
Jayani Nadeesha

Reputation: 21

enter image description here

This saved my life, Just turn off the windows firewall and Give he port number correctly as 3306 as default, then restart MYSQL server . After that turn on the windows defender firewall Just work it fine.

enter image description here

Upvotes: 0

Athan
Athan

Reputation: 221

Clear the "data" directory, then run command mysqld --initialize, and the command net start mysql, bingo!

Upvotes: 22

senthil
senthil

Reputation: 11

MySQL Server can either be run as a Program or as a Service. You cannot run both. You should stop 'mysqld' Server Program before starting 'mysqld' Server as Service.

The 'mysqld' Server Program can be stopped either by typing 'CTRL + c' or by issuing 'mysqladmin -u root -p shutdown' command and issue the password when prompted.

Upvotes: 1

MocXi
MocXi

Reputation: 466

I had the same error, after checked this document: https://dev.mysql.com/doc/refman/8.0/en/data-directory-initialization.html

I just clear data directory and add the --console option to initialize:

bin\mysqld --defaults-file=C:\my.ini
   --initialize --console

Hope this help

Upvotes: 2

MLChris
MLChris

Reputation: 181

1.For the error,

2003: Can't connect to MySQL server on 'localhost' (10061) while connecting to the MySQL server. Upgrade process encountered error and will not continue.

I ran the cmd as administrator and then go to \Program Files\MySQL\MySQL Server 5.7\bin\, and run

mysqld install

2.For the error,

C:\Program Files\MySQL\MySQL Server 5.7\bin>net start mysql
The MySQL service is starting.
The MySQL service could not be started.
The service did not report an error.
More help is available by typing NET HELPMSG 3534.

Try

mysqld --initialize

and then

net start mysql

Thanks to Athan's answer. Those combination worked for me.

Upvotes: 12

imaliveagain
imaliveagain

Reputation: 41

This is old but I was running into the same problem you were seeing. I thought I'd share this answer for anyone looking. I created the data directory as you did initially and tried to start the service and got "Can't open and lock privilege tables: Table mysql.user doesn't exist." I then deleted the contents of the data directory and instead initialized the data directory by running the following command from the bin folder.

mysqld --initialize [with random root password]

mysqld --initialize-insecure [without random root password]

Upvotes: 4

Farhan Habib
Farhan Habib

Reputation: 153

I also had the same problem and I wasted hours solving the issue, but in the end this worked.

  1. Go to you C:\ProgramData\MySQL\MySQL Server 5.7 and copy the my.ini file from there.
  2. Go to C:\Program Files\MySQL\MySQL Server 5.7 and paste it there.
  3. Open cmd and run net start mysql

It would work like a charm.

Explanation:

MySQL couldn't find my.ini, therefore tried to create data in Program Files... where it had no rights to do so, therefore it says access denied every time you run it.

Upvotes: 7

Michyo
Michyo

Reputation: 11

For your error, main cause is in your my.ini setting.
Since you are installing MySQL on Windows, you should define path like:

basedir = C:\\mysql-5.7.10-winx64
datadir = C:\\mysql-5.7.10-winx64\\data

These slashes must be doubled.

Then start your MySQL service again. I guess this time would work.

And here is official document from MySQL.

Upvotes: 1

Mykola
Mykola

Reputation: 1

You need download from https://dev.mysql.com/downloads/mysql/ previous GA versions, and after that copy directory "data" to your new mysql or outher directory what you write in configfile my.ini in directory mysql-"version" .

Upvotes: 0

Related Questions