Home  >  Article  >  Database  >  How to install and uninstall the mysql service under windows (mysql 5.6 zip decompression version installation tutorial)_MySQL

How to install and uninstall the mysql service under windows (mysql 5.6 zip decompression version installation tutorial)_MySQL

WBOY
WBOYOriginal
2016-07-06 13:32:451103browse

MySQL is a small and exquisite but powerful database that is very popular currently. However, the installation package provided by the official website has two formats, one is in msi format and the other is in zip format. Many people unzip the zip format and find that there is no setup.exe. They are confused when faced with a bunch of files and don't know how to install it. The author below will introduce how to solve various problems during the installation process in this case.

Easy steps:

In win2003 and win2008 r2 or above versions:

Extract the downloaded mysql to the specified directory (such as: d:mysql)
Installation Service
Enter
on the command line d:mysqlbinmysqld -install
net start mysql
Uninstall service
Enter
on the command line net stop mysql
d:mysqlbinmysqld -remove

mysql 5.6 decompressed version installation tutorial

Install MySQL as a service
Open a cmd.exe, change the directory to D:MySQL-5.6.13bin, run: mysqld -install, it will prompt that the service installation is successful! Run services.msc to see that there is indeed a service named MySQL. Start it.

At this point, MySQL5.6.13 can be used normally.
Under win2000
Installation Service
Enter
on the command line d:MySQLbinmysqld-nt -install
net start mysql
Uninstall service
Enter
on the command line net stop mysql
d:mysqlbinmysqld-nt -remove
Or directly edit it into a bat file and double-click to execute

win7 or win2008 r2 server system MySQL zip format installation package

1. MySQL installation files are divided into two types, one is in msi format and the other is in zip format. If it is in msi format, you can click to install it directly and follow the installation prompts it gives (I believe everyone can understand the English prompts). Generally, MySQL will be installed in the directory C:Program FilesMySQLMySQL Server 5.6; the zip format is Unzip it yourself. After unzipping, MySQL can actually be used, but it needs to be configured.

2. After decompression, you can rename the folder and put it in a suitable location. I personally recommend renaming the folder to MySQL Server 5.6 and put it in the C:Program FilesMySQL path. Of course, you can also place it anywhere you want.

MySQL 5.6 for Windows 解压缩版配置安装

3. After completing the above steps, many users start to use MySQL, but the error shown in the picture will appear. This is caused by no environment variables being configured. Configuring environment variables is simple:

My Computer->Properties->Advanced->Environment Variables

Select PATH and add after it: the path to your mysql bin folder (such as: C:Program FilesMySQLMySQL Server 5.6bin)

PATH=.....;C:Program FilesMySQLMySQL Server 5.6bin (note that it is appended, not overwritten)

MySQL 5.6 for Windows 解压缩版配置安装

MySQL 5.6 for Windows 解压缩版配置安装

4. After configuring the environment variables, don’t be busy starting mysql. We also need to modify the configuration file (if there is no configuration, the error in the picture will appear when starting!: Error 2 The system cannot find the file ), the default configuration file of mysql-5.6.1X is in C:Program FilesMySQLMySQL Server 5.6my-default.ini, or create a my.ini file yourself,

Modify or add configuration (as shown in the picture):

[mysqld]

basedir=C:Program FilesMySQLMySQL Server 5.6 (the directory where mysql is located)

datadir=C:Program FilesMySQLMySQL Server 5.6data (the directory data where mysql is located)

MySQL 5.6 for Windows 解压缩版配置安装

MySQL 5.6 for Windows 解压缩版配置安装

MySQL 5.6 for Windows 解压缩版配置安装

5. Run cmd as administrator (must run as administrator, otherwise the permissions are not enough),

Input: cd C:Program FilesMySQLMySQL Server 5.6bin Enter the bin folder of mysql (regardless of whether the environment variables have been configured, you must also enter the bin folder, otherwise error 2 will still be reported when starting the service later)

Enter mysqld -install (if you do not run it as an administrator, an error will occur due to insufficient permissions: Install/Remove of the Service Denied!)

Installation successful

MySQL 5.6 for Windows 解压缩版配置安装

MySQL 5.6 for Windows 解压缩版配置安装

6. After the installation is successful, it is time to start the service. Continue to enter: net start mysql in cmd (as shown in the picture), and the service starts successfully!

Many people will make errors at this time, please note:

Note: Error 2 and Error 1067 often appear at this time.

If "Error 2 The system cannot find the file" appears, check whether the configuration file has been modified or whether it has been entered in the bin directory. If the configuration file has been modified correctly and the bin folder has been entered, you need to delete mysql first (enter mysqld -remove) and then reinstall (enter mysqld -install);

If error 1067 occurs, it is a configuration file modification error. Please confirm whether the configuration file is correct.

MySQL 5.6 for Windows 解压缩版配置安装

7. After the service is started successfully, you can log in, as shown in the picture, enter mysql -u root -p (there is no password for the first login, just press Enter), the login is successful!

MySQL 5.6 for Windows 解压缩版配置安装

Notes

The encoding of my.ini file must be English encoding (such as ANSI in windows), not UTF-8 or GBK, etc.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn