MySQL official website: https://dev.mysql.com/downloads/mysql/
Take version 5.7.21 For example
First install package decompression, there is no online tutorial mentioned in the Data folder and My-default.ini, as shown in
Configure environment variables please refer to the online tutorial, this is generally no problem
The main points to note are:
(1) My-default.ini file does not exist unimportant, the key needs to create a new My.ini file in the root directory, the following details:
[mysql]#设置mysql客户端默认字符集default-character-set=utf8 [mysqld]#设置3306端口port = 3306 #设置mysql的安装目录basedir=D:\\soft\\DEV\\mysql-5.7.21#允许最大连接数max_connections=200#服务端使用的字符集默认为8比特编码的latin1字符集character-set-server=utf8#创建新表时将使用的默认存储引擎default-storage-engine=INNODB
You can directly copy and paste, mainly modify the next Basedir after the path, note that the path is \ rather than \
(2) Please do not create the Data folder yourself
Note: Many tutorials on the web suggest that you create a new empty Data folder and add an additional sentence to the My.ini file:
#设置mysql数据库的数据的存放目录
Datadir=d:\softnew\mysql\mysql-5.7.20-winx64\data
这样会导致服务无法启动,不要添加这一句,也不要自己新建data文件夹,由mysql自动生成data就好,具体来说:打开cmd命令窗口,并且进入到mysql安装目录的bin目录下。然后输入命令mysqld install 显示成功
Re-enter: Mysqld--initialize There should be no hint at this time
To start the MySQL command:
net start MySQL
The contents of the last Data folder should appear as:
(3) The following is a new version of MySQL temporary password acquisition method:
1. After installing the database and starting the service for the first time, you need to restart the service again
NET restart MySQL
In the 2.mysql\data directory, an. err file is generated (equivalent to the log log file under Linux, which is occupied by the MySQL service)
3. Using WordPad or Word to open, navigate to temporary password
4. Write down the password, restart the MySQL service, and go to the cmd command line, use mysql-u root-p to login, type the password
5. After entering the database, use Set password for [email protected] = password (' your password '); Reset Login Password
Windows 64-bit MySQL 5.7 or later package decompression installation