MySQL Community Edition: http://dev.mysql.com/downloads/mysql/
Because my system version is 64, download the x64 version here. After downloading, unzip to D:\Dev\Mysql (that is, the custom unzip directory for Mysql. )
My habit is to first register the system service after downloading. CMD open a command prompt and go to D:\Dev\Mysql\bin to install Mysql as a service:
Mysqld.exe-install "ServiceName" (do not start the service after installation, because it will be an error)
Adding environment variables
The operation is as follows:
① Right-click My Computer, properties, advanced system settings (advanced), environment variables
Click the New button under System variables
Input variable name: mysql_home
Input variable Value: D:\Dev\Mysql
② Select the path in the system variable, click the Edit button
Add a variable value to the variable value:%mysql_home%\bin (note that you need to use it after the value of the original variable; Separated, cannot delete the original variable value)
Configuring the Mysql.ini File
Copy the My-default.ini file from the D:\Dev\Mysql root directory to My.ini and replace the contents with the following configuration
?
| 1234567891011121314151617 |
[mysql]# 设置mysql客户端默认字符集default-character-set=utf8 [mysqld]#设置3306端口port = 3306# 设置mysql的安装目录basedir=D:\dev\mysql# 设置mysql数据库的数据的存放目录datadir=D:\dev\mysql\data# 允许最大连接数max_connections=200# 服务端使用的字符集默认为8比特编码的latin1字符集character-set-server=utf8# 创建新表时将使用的默认存储引擎default-storage-engine=INNODB |
Initialize MySQL
This is the biggest difference from the previous version: Starting with 5.7.7, the installation package under Windows does not contain the data directory, which needs to be initialized before starting the service:
Open cmd as Administrator, enter mysqld--initialize-insecure--user=mysql
After executing this command, MySQL will build a data folder in the root directory, and build the default database, the login user name is root, the password is empty
Re-enter the net start MySQL startup service, OK start successfully
Log in to MySQL database
Enter Mysql-u Root-p, the default is no password. Enter directly, root is the user name
Use show databases at this time; You can already see the default database of the initialized build
Change the root account password
After connecting to the MySQL database, use the following command to change the password
Set Password=password (' 123456 ');
Flush privileges;
To log out again, use the new password:
MySQL 5.1.7.17 zip installation