windows安装mysql8
A temporary password is generated for root@localhost: upkiQXrdO8+l
mysql8zip安装教程:
1:下载mysql-8.0.23-winx64 并且解压缩
2: 配置环境变量,比如:
D:\mysql\mysql-8.0.23-winx64\bin,这样在任何地方都能调用mysqld服务
3: 在mysql-8.0.23-winx64 解压后文件夹中新建my.ini [和bin目录同级]
4:my.ini内容如下:
[mysqld] # 设置3306端口 port=3306 # 设置mysql的安装目录 basedir=C:\Program Files\mysql # 设置mysql数据库的数据的存放目录 datadir=C:\Program Files\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
5:用管理员权限打开cmd: 执行:mysqld --initialize --console 初始化mysql
提示如下:
2021-01-30T13:00:13.802113Z 0 [System] [MY-013169] [Server] D:\mysql\mysql-8.0.23-winx64\bin\mysqld.exe (mysqld 8.0.23) initializing of server in progress as process 9580
2021-01-30T13:00:13.802203Z 0 [ERROR] [MY-010338] [Server] Can't find error-message file 'C:\Program Files\mysql\share\errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2021-01-30T13:00:13.822222Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-01-30T13:00:14.558090Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-01-30T13:00:15.885723Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: upkiQXrdO8+l
记住root默认密码:后边会使用到
6:安装myql:mysqld --install
Service successfully installed.
7:启动mysql服务
net start mysql
8:用Navicat连接第一次会提示修改密码