Windows configuration installation-free version (decompressed version) MySQL

1. Download MySql

Open the MySql official website https://www.mysql.com/ and click DOWNLOADS

Insert image description here

Then find the Community (community version, downloading this is enough) download page

Insert image description here

Then select MySQL Community Server

Insert image description here

Then Select Operating System, select Microsoft Windows , and select the first one among Other Downloads to download. If you want to download the installation version, click on the MySql Installer picture to jump to the installation version download page.

Insert image description here

After clicking Download, you may be prompted to log in. Click No thanks, just start my download here.

Insert image description here

2. Configuration and installation

Unzip the downloaded MySql, and then create a my.ini file inside the unzipped file.

Insert image description here

Then copy the following content into it. Note: There should be no extra spaces or other characters, otherwise an error (mysql: [ERROR] unknown option) may be reported when logging in to mysql later (note: don’t forget to modify the mysql path )

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

[mysqld]
# 绑定IPv4
bind-address=127.0.0.1
# 设置端口号
port=3306
# 设置mysql的安装目录,即解压目录
basedir=D:\developers\environments\mysql-8.0.26-winx64
# 设置数据库的数据存放目录
datadir=D:\developers\environments\mysql-8.0.26-winx64\data
# 设置允许最大连接数
max_connections=200
# 设置允许连接失败次数
max_connect_errors=10
# 设置服务端的默认字符集
character-set-server=utf8
# 创建表使用的默认存储引擎
default-storage-engine=INNODB
# 使用“mysql_native_password”插件认证
default_authentication_plugin=mysql_native_password

Then configure the bin directory of MySql into the environment variable, and then execute the following command through cmd to initialize MySql. Be sure to remember root@localhost: the initial password behind , which will be needed when changing the password later.

mysqld --initialize --console

Insert image description here

Then execute the following command to install the MySql service ( Note: Installing the service should require permissions and you need to use the administrator cmd . The administrator cmd can be opened by searching cmd and then opening it as an administrator)

mysqld --install MySql --defaults-file="D:\mysql-8.0.26-winx64\my.ini"

Insert image description here

At this time, when you view the service list, there will be an additional MySql service (right-click this computer , open the management and find the service under Services and Applications to view the service list)

Insert image description here

We start this service, then execute mysql -u root -p in cmd, enter the initial password ( can only be handwritten, cannot be copied, case sensitive )

Insert image description here

Then enter the following command to change the password. The last single quote is the password. Don’t forget the semicolon after it.

alter user 'root'@'localhost' identified with mysql_native_password by '123456';

Insert image description here

At this point, MySql is ready to use

Guess you like

Origin blog.csdn.net/jl15988/article/details/120799856