MySQL8.0.25 installation and configuration tutorial (windows 64-bit) is the most detailed

1. Download MySQL from the official website

Download Mysql Click to download mysql .
Click Download
After the download is complete, extract it to a certain folder (remember this path, you will need it later)
insert image description here

2. Configure the initialization file my.ini

Create a txt file in the root directory named my, the file suffix is ​​ini
, copy the following code and put it in the file
(the newly decompressed file does not have a my.ini file, you need to create it yourself)
The following code is in addition to the installation directory and data storage The directory needs to be modified, and the rest do not need to be modified

[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录   ----------是你的文件路径-------------
basedir=E:\mysql\mysql
# 设置mysql数据库的数据的存放目录  ---------是你的文件路径data文件夹自行创建
datadir=E:\mysql\mysql\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

3. Initialize MySQL

Run CMD as an administrator
insert image description here
to enter the bin directory of mysql

cd E:\mysql\mysql\bin\

insert image description here
Execute the command in the bin directory under the MySQL directory:

mysqld --initialize --console

Copy the password after root@localhost: to a local folder and save it ( there is a space after :, do not copy )
insert image description here

4. Install the mysql service and start + change the password

(1) Install mysql service

mysqld --install mysql

After that, you will be prompted that the service has been successfully installed
insert image description here

(2) Start the mysql service

net start mysql

After entering, it will prompt the following content
insert image description here

(3) Connect to mysql

mysql -uroot -p

After entering, copy the password you just saved and paste it into the command console
insert image description here
Enter the following command to change the password (change the new password to the password you want)

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

insert image description here
Password change completed

5. Configure environment variables

insert image description here
Add the following code to the path
insert image description here

6. Some incurable diseases

  1. Execute mysqld --install mysql If it prompts that the service already exists
    insert image description here
    , delete the service first (use the following code)
    sc delete mysql
    
    Then execute mysqld --install mysql

7. Use the connection tool to connect to mysql

The connection tool I am using is DataGrip** (student certification activated)**

  • Attach the download address https://www.jetbrains.com/datagrip/
  • The memory occupied by the DataGrip background is relatively large. I run it at more than 1G each time. I hope you can use it at your own discretion.
  • Navicat is also a good tool ( download address ) Readers can choose different connection tools according to their own preferences
  • After opening DataGrip, follow the steps below to add the database
    insert image description here
    and continue with the following steps (copy the URL from mine)
 jdbc:mysql://localhost:3306?serverTimezone=GMT

insert image description here
After entering show databases , check the results. If the following results appear, the configuration is successful! ! !
insert image description here

This is the end of the tutorial. If you think it’s not bad, please move your hands and give it a thumbs up before leaving!

Guess you like

Origin blog.csdn.net/weixin_43579015/article/details/117228159