The first step: Download https://dev.mysql.com/downloads/mysql/on the website
Step Two: Extract to a folder
Step Three: Configure environment variables
To insert a%mysql_home%\bin into the last face of a path.
Fourth step: Run the command line as an administrator, press Win+r to enter CMD, click the right mouse button to run as Administrator
Fifth step: Go to E:\mysql-5.7.22-winx64\bin
Here's the point : Enter in the DOS window: mysqld--initialize-insecure or mysqld--initialize-insecure--user=mysql
Note that some tutorials write the following to create an empty folder named data. And then create the My.ini file, this is wrong, because the self-built data folder does not have the MySQL boot required table structure configuration file, so to initialize first, enter the above command, initialization after looking at the MySQL folder will find more than a folder called data, Note that the Data folder is created by the system and is not created manually , it takes a few seconds to run, DOS
Initialize data:
After initialization you will see the MySQL table structure under the Data folder:
Create the My.ini file under the data directory generated after initialization:
[MySQL]
#设置mysql客户端默认字符集
Default-character-set=utf8
[Mysqld]
#设置3306端口
port=3306
#设置mysql的安装目录
basedir=e:\mysql-5.7.22
#设置mysql数据库的数据的存放目录
Basedir=e:\mysql-5.7.22-winx64
Datadir=e:\mysql-5.7.22-winx64\data
#允许最大连接数
max_connections=200
#服务端使用的字符集默认为8比特编码的latin1字符集
Character-set-server=utf8
#创建新表时将使用的默认存储引擎
Default-storage-engine=innodb
DOS Window re-enter: Mysqld-install (if it already exists, you can delete it using SC delete mysql or mysql-remove)
The service successfully installed is displayed:
5.dos window and re-enter: net start MySQL or: mysqld--user=mysql #启动mysql服务
6. In the computer-administration-services and applications-services, you can see that MySQL has been started, or that the shortcut keys are viewed Services.msc
7. Log in to the MySQL database, the initialization of the time to skip the password, so the default this does not have a password, enter the return, you can log into the database
Installing MySQL under Windows