Can't start service solution when mysql is installed

 1. Unzip the file

           After downloading MySQL, decompress it to the D drive, or decompress it in the path of other drive letters according to personal preference. The decompressed path is: D:\mysql-5.7.17-winx64. Don't get too excited after unzipping, you need to configure the default file!

      Second, configure the default file

           The decompressed file has a default configuration file (my-default.ini), but the default configuration file is not easy to use, and there will be many problems when using it, such as the Chinese characters in it are all garbled and so on. So you need to configure the personal default configuration file: create a new file in the decompressed path: my.ini, copy the following code into it, D:\mysql-5.7.17-winx64 appears twice in the code, this is the decompression of my MySQL path, you can replace it according to your own path. At this point, MySQL can be installed.

copy code
[mysql]
# Set the default character set of the mysql client
default-character-set=utf8
[mysqld]
#Set 3306 port
port = 3306
# Set the installation directory of mysql
basedir="D:\mysql-5.7.17-winx64"
# Set the storage directory for the data of the mysql database
datadir="D:\mysql-5.7.17-winx64\data"
# maximum number of connections allowed
max_connections=200
# The character set used by the server defaults to the 8-bit encoded latin1 character set
character-set-server=utf8
# The default storage engine that will be used when creating new tables
default-storage-engine=INNODB
copy code

      3. Install MySQL

           Run the command prompt as an administrator, switch to the MySQL bin directory, enter the mysqld install command (note that it is mysqld instead of mysql) and press Enter to install MySQL, as shown in the following figure:

                                       The installation is successful if the prompt is as follows:

 

      Fourth, start the MySQL service

           After installing MySQL, you can enter net start mysql to start MySQL, enter net stop mysql to close the MySQL service, or you can manually start/close the MySQL service in the service;

      Five, configure environment variables

           Although MySQL is installed successfully, it is very troublesome to switch to:\mysql-5.7.17-winx64 every time to perform related operations. After configuring environment variables, you can easily operate MySQL. Right-click 'Computer'->'Properties'->'Advanced System Settings'->'Environment Variables', find the path under System Variables, click the Edit button to enter the Edit Path dialog box, and add the decompression path of MySQL in front of the variable value Under the bin directory, mine is D:\mysql-5.7.17-winx64\bin;, note that the English semicolon should be added after, and the environment change is configured after confirming.

 

     6. Errors and precautions in the installation process

          When I start the MySQL service after the installation is successful, the service cannot be started, and the prompt: MySQL service cannot be started The service does not report any errors Please type NET HELPMSG 3534 for more help, as follows:

          Solution: After installing MySQL, open the cmd command window, and enter the bin directory in the MySQL installation directory, then enter the following command and press Enter: mysqld --initialize-insecure --user=mysql
After executing the above command, MySQL will build a data folder by itself, and build a default database. The login user name is root and the password is empty. After that, you can start the mysql service through the command net start mysql.
          Note: There is no data folder when MySQL is upgraded to version 5.7. Executing the mysqld --initialize-insecure --user=mysql command will automatically create a new data folder.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325642087&siteId=291194637