下载mysql8.0

https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.40-winx64.zip

解压


改配置文件

新建data文件夹

新建my.ini

[mysqld]
default-time_zone = '+8:00'
basedir=D:\Software\mysql-8.0.40-winx64
datadir=D:\Software\mysql-8.0.40-winx64\data

bind-address=127.0.0.1
mysqlx-bind-address= 127.0.0.1
max_connections=200
max_connect_errors=10
character-set-server=utf8

[mysql]
default-character-set=utf8

[client]
port=3306

执行命令

cd bin
.\mysqld.exe --initialize --console

会出现初始密码,临时存一下

./mysqld.exe --install  mysql

点任务栏的搜索,搜服务

打开找Mysql

连接mysql

mysql -u root -p

会提示输入密码,把刚才的临时密码粘进来就行了

然后需要改密码

alter user 'root'@'localhost' IDENTIFIED BY '123456';
exit

mysql -u root -p

使用图形化

点Installer
下载上安装