Mysql-5.7.12-winx64 Unable to start service issue when installing

Source: Internet
Author: User
Tags mysql client

1. Download the latest version of the Mysql-5.7.12-winx64 portable version from the official website, unzip it to the directory that needs to be installed (mine is extracted in: D:\SW), the directory structure is as follows:


2. Under this directory, create an empty folder named Data and a My.ini file with the following directory structure:


The contents of My.ini are as follows (here the path of Basedir and DataDir is the installation path after I unzipped, if you copy the following, change the address to your own path ):

[MySQL]
# Set the MySQL client default character set
Default-character-set=utf8
[Mysqld]
#设置3306端口
Port = 3306
# set up the MySQL installation directory
Basedir=d:\\sw\\mysql-5.7.12-winx64
# Set up a storage directory for MySQL database data
Datadir=d:\\sw\\mysql-5.7.12-winx64\\data
# Maximum number of connections allowed
max_connections=200
# The character set used by the service side defaults to the 8-bit encoded latin1 character set
Character-set-server=utf8
# The default storage engine that will be used when creating a new table
Default-storage-engine=innodb

3. Start cmd as an administrator, go to the MySQL bin directory, execute mysqld--initialize-inscure (do not set root password, recommended)

4. Install MySQL service and execute mysqld-install after 3 execution

5. You can start the service at this time:net start MySQL



So our service has been successfully opened.


Problem Summary: In the previous open service process failed many times, but also from the Internet to find the cause of the problem, the following I will introduce the problems I encountered, for your reference only, if there are other issues welcome to put forward.

Q1: During the first installation, the My.ini directory was created according to the method on the Internet, and the contents of the file were as follows:

[mysql]
# set MySQL client default character set
default-character-set=utf8 
[mysqld]
#设置3306端口
Port = 3306 
# Set the installation directory for MySQL
basedir=d:\sw\mysql-5.7.12-winx64
# To set the data storage directory for the MySQL database
Datadir=d : \sw\mysql-5.7.12-winx64\data
# Allow maximum number of connections
max_connections=200
# Server uses a character set that defaults to a 8-bit encoded latin1 character Set
Character-set-server=utf8
# Default storage engine to use when creating new tables
Default-storage-engine=innodb

< Span style= "FONT-SIZE:16PX; Line-height:28px "> Do you see the difference between this and the contents of the My.ini file in my second step? Yes, basedir and datadir's path is different," \ "and" \ \ "The difference, the resulting problem will say

then go to the Bin directory and enter mysqld-install, will prompt installation success, continue to start the service, execute net start MySQL, will find the service can not start, report the error: The service is starting, the service does not start, the service did not report any errors, please type NET helpmsg 3534, then search the keyword, Found that many people say that the data directory is missing, Uninstall the installation of 5.6.X can, so look at their own decompression files found really no, but do not want to uninstall the installation, because the installation of other version of the problem is still there, the next encounter or not solve Ah, if the issue of the version, the official website released, so many people installed, there are problems can be found online, so continue to find the question 。

Continue Baidu find MySQL how to create data file, see the method: 1 in the compressed file created data empty folder 2 Create a My.ini file, the contents of the same q1,3 initialize the data folder, execute mysqld--initialize-inscure (Not set root password, recommended), this time the problem:

D:\sw\mysql-5.7.12-winx64\bin>mysqld–initialize-insecure
Mysqld:can ' t change dir to ' d:w\mysql-5.7.12-winx64\data\ ' (Errcode:2-No su
ch file or directory)
2016-04-12t02:31:24.980888z 0 [Warning] TIMESTAMP with implicit DEFAULT value is
Deprecated. --explicit_defaults_for_timestamp server Option (see doc
Umentation for more details).
2016-04-12t02:31:24.980888z 0 [Warning] Insecure configuration for--secure-file
-priv:current value does not restrict the location of generated files. Consider set
Ting it to a valid, Non-empty path.
2016-04-12t02:31:24.980888z 0 [Note] mysqld (mysqld 5.7.12) starting as Process
10788 ...
2016-04-12t02:31:24.981888z 0 [ERROR] Can ' t find error-message file ' D:\sw\mysql
-5.7.12-winx64\bin\ W\mysql-5.7.12-winx64\share\errmsg.sys '. Check Error-message
File location and ' lc-messages-dir ' configuration directive.
2016-04-12t02:31:24.982888z 0 [Warning] Can ' t ' Create test file d:w\mysql-5.7.12
-winx64\data\pc-20150316207.lower-test
2016-04-12t02:31:24.982888z 0 [Warning] Can ' t ' Create test file d:w\mysql-5.7.12
-winx64\data\pc-20150316207.lower-test
2016-04-12t02:31:24.983888z 0 [ERROR] failed to set DataDir to d:w\mysql-5.7.12
-winx64\data\
2016-04-12t02:31:24.984888z 0 [ERROR] aborting


2016-04-12t02:31:24.985888z 0 [Note] Binlog End
2016-04-12t02:31:24.986888z 0 [Note]

Report this error after execution, see this hintCan ' t change dir to ' d:w\mysql-5.7.12-winx64\data\ ' (Errcode:2-No su
ch file or directory", it seems that the current directory does not exist, and the bizarre is   ' d:w\mysql-5.7.12-winx64\data\ ' this thing, data I obviously put in" d:sw\mysql-5.7.12-winx64\data\ " below, S? Is it because of the SW folder problem? Then I try to create a new MySQL folder, unzip the package to the directory, continue the above steps, will find execute mysqld  --initialize-inscure passed, and a bunch of files were generated in the data directory:

< Span style= "font-family: ' Microsoft Yahei ', Microsoft Ya Black, arial, XXFarEastFont-Sans-serif; font-size:16px; line-height:28px; Color:rgb (51,51,51); Text-align:justify ">

Heart secretly happy, this is always the success of it, then execute mysqld-install, installation successful, exciting time to come, start service, execute net start MySQL, but backfired: still reported service is starting, service cannot start, service does not report any errors, type net helpmsg 3534

What a depression, what's the situation ah ...

The problem is still not solved ah, continue to find the answer, found that there are netizens said data directory is not a MySQL folder, so I went to compare the 5.6.17 found his data directory has three folders and a bunch of files:


According to the Netizen, I copied the entire MySQL file to my data directory, continue to execute net start MySQL, and finally started the service successfully.

< Span style= "FONT-SIZE:16PX; line-height:28px "> service finally started, always feel a bit imperfect, why my data directory is different from others, why so many people on the net to do mysqld  --initialize-inscure success, no problem, and my always can not?" This problem is still hidden, the key is to continue to find the answer:

mysqld:can ' t change dir to ' d:w\mysql-5.7.12-winx64\data\ ' (Errcode:2-No su
ch file or directory"

This error should still not solve, ba la a half-day, a netizen prompted My.ini basedir and datadir problem," \ "should be replaced with" \ \ ", so re-decompression in the" D:\SW "(I want to verify that the directory is not a problem so re-extract to the following authentication), Modify the My.ini, re-follow the steps of this article, the perfect pass, at this point the data directory will find that all the files have:


Mysql-5.7.12-winx64 Unable to start service issue when installing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.