This article mainly introduces how to add MySQL to the system service in a Windows system, mainly for the mysql decompress version. if you are interested, refer to MySQL software version: 64-bit 5.7.12.
1. first configure the MySQL environment variable, add the bin directory Path of MySQL at the beginning of the system environment variable Path, and end with ";". The Path configuration is as follows:
2. modify the contents of the my-default.ini file under the MySQL root directory; mainly modify two attributes: basedir and datadir.
Basedir: root directory of MySQL;
Datadir: Directory for storing database data (the directory must be manually created );
Notes:
It is best to use a backslash to slash the Directory, without escaping or adding double quotation marks;
The datadir directory must be created in advance.
3. use the system administrator to start CMD (command prompt) and enter the bin directory of MySQL (this step is required even if the Path is configured !); For example:
4. to install the MySQL service, enter the command mysqld-install and press Enter. the following prompt indicates that the installation is successful:
-The install command can also specify the address of the configuration file, as follows: mysqld-install MySQL -- defaults-file = "D: \ software \ mysql5.7.12 \ my-default.ini"
5. initialize the MySQL service and enter the command mysqld -- initialize.
We recommend that you clear the datadir directory before executing this command. otherwise, Initialization may fail.
For example, the system prompts 3534 error
6. start the MySQL service and enter the command: net start mysql. the startup is successful, for example:
Other common commands:
1. stop the MySQL service and enter the command: net stop mysql
2. remove the MySQL service and enter the command mysqld-remove.
The above section describes how to add MySQL to the system service (mysql decompress version) _ MySQL in Windows. For more information, see PHP Chinese website (www.php1.cn )!