mysql5.8 installation-free version (compressed package) win10 installation


Mysql5.8 installation pitfall record, it is recommended to use Docker installation, my computer virtualization may cause a blue screen and this function is not used.

1. Download MySQL5.8

Download address: https://dev.mysql.com/downloads/mysql/Click
to download. You don’t need to register Oracle. You can download it directly.
Note that the official website defaults to the latest version. You can click Archives to download the version you want! !
Insert image description here
No need to register Oracle, you can download it directly
Insert image description here

2. How to install and configure

After downloading mysql-8.1.0-winx64.zip, unzip it and put it in the D:\sofware directory. Mysql-8.1.0-winx64 will be renamed mysql-8.0.17.

Create the my.ini file in the D:\sofware\mysql-8.1.0 directory
Insert image description here

my.ini configuration

Notice

  • Note that the file path must be two\
    otherwise an error will be reported.Insert image description here

  • Do not create the Data directory in the root directory manually.

[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=D:\\sofware\\mysql-8.1.0
# 设置mysql数据库的数据的存放目录
datadir=D:\\sofware\\mysql-8.1.0\Data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。
max_connect_errors=10
# 服务端使用的字符集默认为utf8mb4
character-set-server=utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8mb4
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8mb4

3Initialize mysql

3.1. Initialize mysql

Enter the bin directory under the installation directory with administrator rights, initialize mysql, and record the randomly generated password.

 D:\sofware\mysql-8.1.0\bin> mysqld --initialize --console

mysqld --initialize --console Remember the random password and need to use it later
Insert image description here

3.2. Install mysql service

mysqld --install MySQL

3.3. Start mysql

Start mysql

net start mysql

Additional commands:

net stop mysql

3.4. Log in to mysql

D:\sofware\mysql-8.0.17\bin>mysql -uroot -p
Enter password: ************

3.5. Change root password

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '******';

This will report an error
. Solution:
https://blog.csdn.net/eggsound/article/details/105621149
Insert image description here
The quotation marks of the blog are in Chinese.

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

3.6. Configure remote connection

Use the mysql library: use mysql;

Guess you like

Origin blog.csdn.net/qq_41398619/article/details/132835609