Service issue cannot be started during mysql-5.7.12-winx64 Installation
1. download the latest mysql-5.7.12-winx64 portable version from the official website, decompress to the directory to be installed (My is decompressed in: D: \ sw), the directory structure is as follows:
2. Create an empty folder named data and a my. ini file under the directory. The directory structure is as follows: <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + pgltzybzcm9 "" alt = "\">
Here, the content of my. ini is as follows (the path of basedir and datadir is the installation path after I decompress it. If you copy the following content, replace the address with your own path ):
[Mysql]
# Set the default Character Set of the mysql client
Default-character-set = utf8
[Mysqld]
# Set port 3306
Port = 3306
# Set the installation directory of mysql
Basedir = D: \ sw \ mysql-5.7.12-winx64
# Set the directory for storing mysql database data
Datadir = D: \ sw \ mysql-5.7.12-winx64 \ data
# Maximum number of connections allowed
Max_connections = 200
# The default character set used by the server is the 8-bit latin1 character set.
Character-set-server = utf8
# The default storage engine used to create a new table
Default-storage-engine = INNODB
3. Start cmd as an administrator, enter the bin directory of mysql, and execute mysqld -- initialize-inscure (do not set the root password. We recommend that you use it)
4. install the mysql service. 3. Execute mysqld-install after execution.
5. Now you can start the service: net start mysql
In this way, our service is successfully enabled.
Problem summary: I failed to start the service many times, but also found the cause of various problems on the Internet. Next I will introduce the problems I encountered for your reference only, if you have other questions, please submit them.
Q1: During the first installation, the my. ini directory was created according to the online method. The file content at that time was as follows:
[Mysql]
# Set the default Character Set of the mysql client
Default-character-set = utf8
[Mysqld]
# Set port 3306
Port = 3306
# Set the installation directory of mysql
Basedir = D: \ sw \ mysql-5.7.12-winx64
# Set the directory for storing mysql database data
Datadir = D: \ sw \ mysql-5.7.12-winx64 \ data
# Maximum number of connections allowed
Max_connections = 200
# The default character set used by the server is the 8-bit latin1 character set.
Character-set-server = utf8
# The default storage engine used to create a new table
Default-storage-engine = INNODB
What is the difference between the content of the my. ini file in step 2 and that in step 2? Yes, the basedir and datadir paths are written differently. The difference between "\" and "\" will be explained later.
Enter mysqld-install in the bin directory. A prompt is displayed, indicating that the installation is successful. Continue to start the service and run net start mysql. if the service cannot be started, an error is reported: the service is starting, the service cannot be started, and no error is reported. Please type net helpmsg 3534, so search for the keyword and find that many people say that the data directory is missing. Uninstall and install 5.6.X, so I checked my unzipping file and found that there was no decompressed file, but I didn't want to uninstall and install it. If I installed another version, this problem still exists. I still won't be able to solve it next time, if the current version has been released on the official website, many people will be able to install it. If there are any problems, they will be able to find them online, so they will continue to look for questions and answers.
Continue to Baidu to find mysql how to create a data file, see the method of netizens: 1 create a data empty folder under the compressed file 2 create my. INI file with the same content as Q1 and 3 initialize the data folder and execute mysqld -- initialize-inscure (we recommend that you do not set the root password). At this time, the problem arises:
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. Please use -- 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 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 ctictive.
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]
This error is reported after execution. See the prompt Can'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 strange thing is the 'd: w \ mysql-5.7.12-winx64 \ data \ ', data I clearly put in "D: sw \ mysql-5.7.12-winx64 \ data \ "What about s? Is it because of sw folder issues? Then I tried to create a new MySql folder, decompress the compressed package to the directory, and continue the above steps, and the execution of mysqld -- initialize-inscure is successful, in addition, a bunch of files are generated under the data directory:
In my heart, it's time to succeed, and then execute mysqld-install. The installation is successful. It's exciting to start the service and execute net start mysql. However, this is counterproductive: the system still reports that the service is being started and the service cannot be started. The service does not report any errors. Enter net helpmsg 3534
My heart is frustrated. What is the situation ......
The problem still persists. Continue to find the answer and find some netizens saying that there is no mysql folder in the data directory, so I checked 5.6.17 and found that his data directory contains three folders and a bunch of files:
According to netizens, I copied the entire mysql file to my data directory, continued to execute net start mysql, and finally successfully started the service.
The service was finally started, and I always felt a little imperfect. Why is my data DIRECTORY different from others? Why did so many people on the internet execute mysqld -- initialize-inscure successfully? No problem, but I always cannot? It indicates that there are still hidden risks. The key to continuing to find the answer lies in:
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 be solved. After pulling it for half a day, some netizens prompted me. for basedir and datadir problems in ini, "\" should be replaced by "\", so decompress it in "D: \ sw "(I want to verify if it is a directory problem, so decompress it to verify), modify my. ini, re-follow the steps in the beginning of this article, the perfect way, now you can see that the data directory will find that all the files have: