点击下载MySQL
2.解压到本地磁盘(注意路径中不要有中文)
3.在解压目录创建my.ini文件
文件内容为
[mysql]# 设置mysql客户端默认字符集default-character-set=utf8 [mysqld]# 设置端口port = 3306# 设计mysql的安装路径basedir=E:\01.app\05.Tools\MySQL8.0.22\mysql-8.0.22-winx64# 设置mysql数据库的数据的存放目录datadir=E:\01.app\05.Tools\MySQL8.0.22\mysql-8.0.22-winx64\data# 允许最大连接数max_connections=20# 允许连接失败的次数。max_connect_errors=10# 服务端使用的字符集默认为utf8character-set-server=utf8# 设置时区为东八区default-time-zone='+08:00'# 创建新表时将使用的默认存储引擎default-storage-engine=INNODB
配置环境变量 找到系统变量path,选中编辑再新建,把本地磁盘mysql的bin路径复制进来
5.管理员运行cmd
6.切换到MySQL的安装路径
cd E:\01.app\05.Tools\MySQL8.0.22\mysql-8.0.22-winx64
输入初始化命令
C:\Windows\system32>mysqld --initialize --console2023-08-29T10:26:48.544270Z 0 [System] [MY-024169] [Server] E:\01.app\05.Tools\MySQL8.0.22\mysql-8.0.22-winx64\bin\mysqld.exe (mysqld 8.0.22) initializing of server in progress as process 381232023-08-29T10:26:48.545665Z 0 [Warning] [MY-024242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.2023-08-29T10:26:48.557204Z 1 [System] [MY-024576] [InnoDB] InnoDB initialization has started.2023-08-29T10:26:49.240892Z 1 [System] [MY-024577] [InnoDB] InnoDB initialization has ended.2023-08-29T10:26:51.597757Z 6 [Note] [MY-020454] [Server] A temporary password is generated for root@localhost: bafDBifeAp0_b
注意要记住此时生成的密码 !在打印的文字结尾。
8.输入安装命令
C:\Windows\system32>mysqld --install
输入启动命令
C:\Windows\system32>net start mysql
使用初始化的用户名登陆
C:\Windows\system32>mysql -u root -p
回车输入刚刚记录的密码
10.修改密码
C:\Windows\system32>ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
刷新权限
C:\Windows\system32> FLUSH PRIVILEGES;
测试验证
使用Navicat新建连接验证,点击下载破解版Navicat
来源地址:https://blog.csdn.net/weixin_44054222/article/details/132556014