Document

windows11下安装MySQL 8.0 步骤

1、mysql 包下载地址

2、包解压到一个目录

这里解压到:D:\soft\mysql-8.0.29-winx64

3、设置系统环境变量

设置--系统-关于--高级设置
设置  MYSQL_HOME 为  D:\soft\mysql-8.0.29-winx64
在path新增:%MYSQL_HOME%\bin

4、初始化数据库

  用管理员身份运行打开cmd,  进入mysql 的家目录后执行:mysqld --initialize --user=mysql --console  
1
2
3
4
5
PS D:\soft\mysql-8.0.29-winx64> mysqld --initialize --user=mysql --console
2022-05-07T03:55:39.467613Z 0 [System] [MY-013169] [Server] D:\soft\mysql-8.0.29-winx64\bin\mysqld.exe (mysqld 8.0.29) initializing of server in progress as process 2984
2022-05-07T03:55:39.501750Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-05-07T03:55:44.517147Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-05-07T03:55:53.099028Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 7<#taICzh1!F
7<#taICzh1!F  这个是初始化的的密码

5、启动mysql服务

输入mysqld -install进行服务的添加
输入net start mysql启动服务
1
2
3
4
5
PS D:\soft\mysql-8.0.29-winx64> mysqld -install
Service successfully installed.
PS D:\soft\mysql-8.0.29-winx64> net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

6、登录数据库

输入mysql -u root -p
1
2
3
4
5
PS D:\soft\mysql-8.0.29-winx64> mysqld --initialize --user=mysql --console
2022-05-07T03:55:39.467613Z 0 [System] [MY-013169] [Server] D:\soft\mysql-8.0.29-winx64\bin\mysqld.exe (mysqld 8.0.29) initializing of server in progress as process 2984
2022-05-07T03:55:39.501750Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-05-07T03:55:44.517147Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-05-07T03:55:53.099028Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 7<#taICzh1!F

7、修改数据库的密码

ALTER USER root@localhost IDENTIFIED BY '你的密码'; 
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
然后输入FLUSH PRIVILEGES;
这两句是为了让你navicat连的时候,不报1251错误的。

8、参考

参考
http://www.manongjc.com/detail/29-hkozxdjeclrtryf.html
posted @ 2024-08-20 10:29  从未被超越  阅读(249)  评论(0编辑  收藏  举报