Mysql - compressed package installation tutorial

1. How to download Mysql compressed package

The zip version (5.7 and 8.0) needs to be downloaded from the official website. Different versions can be installed under different operating systems. This article introduces the installation method of mysql-8.0.30-winx64 under win10.

Download URL:MySQL :: Download MySQL Community Server

2. Mysql installation process

 1. Download the compressed package to the local directory.

2. Find the Mysql compressed package in the downloaded directory and extract it to a folder you created (note: the directory name cannot be in Chinese)

3. Create an .ini configuration file and data folder in the downloaded Mysql file, and configure the .ini.

Configuration .ini file content:

[mysqld]
 # 设置3306端口
 port=3306

 # 自定义设置mysql的安装目录,即解压mysql压缩包的目录
 basedir=D:\DB\mysql-8.0.30-winx64

 # 自定义设置mysql数据库的数据存放目录
 datadir=D:\DB\mysql-8.0.30-winx64\data

 # 允许最大连接数
 max_connections=200

 # 允许连接失败的次数,这是为了防止有人从该主机试图攻击数据库系统
 max_connect_errors=10

 # 服务端使用的字符集默认为UTF-8
 character-set-server=utf8mb4

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

 # 默认使用“mysql_native_password”插件认证
 default_authentication_plugin=mysql_native_password

[mysql]
 
 # 设置mysql客户端默认字符集
 default-character-set=utf8mb4

[client]

 # 设置mysql客户端连接服务端时默认使用的端口和默认字符集
 port=3306
 default-character-set=utf8mb4
4. Configure environment variables: Configure the file path of bin in the Mysql file to the environment variable of the local machine, so that it can be opened under any path in cmd.

Computer Properties-->Advanced System Properties-->Environment Variables-->Configuration Path

5. Open cmd (must be opened as administrator).

(1).Initialization command (record the random password given by the console and remember it):

mysqld --initialize --console (copy directly to the console, remember the generated password)

(2). Then first create a name for the mysql service (to facilitate the establishment of multiple mysql services without conflict)

mysqld --install mysql8

(3). Start the service:

net start mysql

(4). Log in with the old password (password in step 3):

mysql -u root -p

(5).Change password

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码';

(6). Enter quit to exit Mysql

(7). Log in again using the new password: mysql -u root -p

At this point, Mysql installation is complete! ! !

Guess you like

Origin blog.csdn.net/qq_63099085/article/details/133127324