win10安装mysql8.0及以上版本
参考:
2. windows下安装mysql ,在starting server时卡住,解决方法(亲测有效!)
3. mysql安装:“root@localhost is created with an empty password !”,而非A temporary password is generated for
5. 解决Navicat for MySQL 连接 Mysql 8.0.11 出现1251- Client does not support authentication protocol 错误
【问题一】: [Server] Failed to set datadir to 'C:\Program Files\MySQL\MySQL Server 8.0\data\' (OS errno: 2 - No such file or directory)
探索【解决方案】:
1 PS C:\Program Files\MySQL\MySQL Server 8.0\bin> net start mysql 2 服务名无效。 3 4 请键入 NET HELPMSG 2185 以获得更多的帮助。 5 6 PS C:\Program Files\MySQL\MySQL Server 8.0\bin> net start mysql80 7 MySQL80 服务正在启动 . 8 MySQL80 服务已经启动成功。
由上面的 两条命令,可以得出,在安装时,所填写的 服务名 在服务启动时 需要对应, 即 我安装时的服务名为mysql80(建议安装时,直接填写mysql就好了)
紧接着有新的问题出现:
【问题二】:
PS C:\Program Files\MySQL\MySQL Server 8.0\bin> mysql -u root -p
Enter password: ****
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
【解决方案】:
需要执行命令 mysqld --initialize --console
有效果:
1 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 2 PS C:\Program Files\MySQL\MySQL Server 8.0\bin> mysqld --initialize --console 3 2020-07-18T23:11:16.118917Z 0 [System] [MY-013169] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.21) initializing of server in progress as process 11604 4 2020-07-18T23:11:16.154028Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 5 2020-07-18T23:11:16.816647Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 6 2020-07-18T23:11:18.026729Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: rdUko8M6sv(*
【问题三】:运用 随机生成的 密码,无法登陆mysql
2020-07-18T23:11:18.026729Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: rdUko8M6sv(*
PS C:\Program Files\MySQL\MySQL Server 8.0\bin> mysql -u root -p
Enter password: **********
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
探索【解决方案】:
PS C:\Program Files\MySQL\MySQL Server 8.0\bin> net start mysql MySQL 服务正在启动 . MySQL 服务无法启动。 PS C:\Program Files\MySQL\MySQL Server 8.0\bin> net stop mysql80 MySQL80 服务正在停止. MySQL80 服务已成功停止。 // 手动删除 data文件 // 再次执行命令 mysqld --initialize --console PS C:\Program Files\MySQL\MySQL Server 8.0\bin> mysqld --initialize --console 2020-07-18T23:18:19.879859Z 0 [System] [MY-013169] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.21) initializing of server in progress as process 5672 2020-07-18T23:18:19.891863Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2020-07-18T23:18:20.462623Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2020-07-18T23:18:22.557307Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: _t2kuyQi*B4t PS C:\Program Files\MySQL\MySQL Server 8.0\bin> net start mysql MySQL 服务正在启动 . MySQL 服务已经启动成功。 PS C:\Program Files\MySQL\MySQL Server 8.0\bin> mysql -u root -p Enter password: ************ Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.21 Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> alter user 'root'@'localhost' identified by 'root'; Query OK, 0 rows affected (0.02 sec)
以上完成了 5 步操作:
(1)停掉 mysql80服务;
(2)mysql 安装目录,删去 data;
(3)重新初始化mysql,同时生成随机的登陆密码;
(4)利用随机密码登录;
(5)修改登录密码。
圆满 安装 mysql-installer-community-8.0.21.0.msi
【navicat 管理mysql】
【问题四】: Navicat for MySQL 连接 Mysql 8.0.11 出现1251- Client does not support authentication protocol 错误
【解法】:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则 ('password'是你设置的mysql的登录密码,我的是root,进行替换)
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码
FLUSH PRIVILEGES; #刷新权限(可能不需要,我就没有执行刷新,也成功了)