Win installation mysql5.7 decompressed version

Window installs the decompressed version of mysql5.7

mysql decompressed version download

Click to enter the download address
Download page
Product Version: Select the version you want to download to display the compressed package of the corresponding version number, and you can choose to download it

mysql compressed package decompression configuration

1. Extract the downloaded compressed package to the storage location
The data folder and my.ini file do not exist after decompression and need to be added by yourself
Insert image description here
2.data directory and my.ini file are newly created files for yourself
The content of my.ini is as follows

[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
 
[mysqld]
# 设置3307端口
port = 3307

# 设置mysql的安装目录
basedir=D:\mysql-5.7.20\mysql-5.7.20-winx64

# 设置 mysql数据库的数据的存放目录(MySQL8.0+ 不需要以下配置,系统自己生成即可,否则有可能报错)
datadir=D:\mysql-5.7.20\mysql-5.7.20-winx64\data

# 允许最大连接数,windows下最多为2038
max_connections=256

# 设置服务端使用的字符编码为utf-8
character-set-server=utf8

# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

3. Generate mysql service
Enter the cmd command line interface as an administrator=》Switch to the bin directory where mysql is decompressed=》Execute statement generation service

mysqld install MySQL5720 --defaults-file="D:\mysql-5.7.20\mysql-5.7.20-winx64\my.ini"

The service nameMySQL5720 can be customized
D:\mysql-5.7.20\mysql- 5.7.20-winx64\my.ini ismy.iniabsolute path to file

Insert image description here
displays Service successfully installed. It means the installation is successful.
If you encounter The service already exists!, re-enter the cmd command line as an administrator and execute:

sc query MySQL5720

Check whether the service exists, delete it if it exists (or directly change the service name)

sc delete MySQL5720

4. Initialize the database
Search and enter the cmd command line and switch to the bin directory of mysql and execute the following command

mysqld --initialize --user=mysql --console

The results are as follows:
Insert image description here
The red part is the initial password
You can also go to the *.err file under the datadir location specified in the my.ini file , view the file content to obtain the initial password

5. Check the database registry information
Enter the registry to view the service you just registered: location
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MySQL5720
inMySQL5720Same as the service name above
Check whether the value of ImagePath is correct; if it is incorrect, correct it
Insert image description here
D:\mysql-5.7.20\mysql -5.7.20-winx64\bin\mysqld --defaults-file=D:\mysql-5.7.20\mysql-5.7.20-winx64\my.ini MySQL5720
where --defaults The path before -file is the path to mysqld in the bin directory where mysql is decompressed and installed
, and the path after --defaults-file is the path to the my.ini file plus a space followed by the current service name
When installing multiple mysql on the same computer, you need to check this item carefully to see whether the two paths before and after match the corresponding mysql path information.

5. Start the database
net start + (customized service name)

net start MySQL5720

Insert image description here
6. Modify the database password
Use the initial password to enter the database
Insert image description here
Execute the statement (SET PASSWORD = PASSWORD('custom password')) to change the password
Insert image description here

over

Guess you like

Origin blog.csdn.net/qq_41995299/article/details/107790164