win7 / mysql-8.0.11-winx64 安装的测坑步骤

时间:2022-12-18 03:49:45
虚惊一场,主要问题是 Navicat Premium 连接 mysql8  Client does not support authentication 。

1.  下载 官网下载压缩包: mysql-8.0.11-winx64.zip

2. 解压到想要安装的目录:然后在安装包下新建文件my.ini 内容如下:(注意basedir/datadir...data根据自己的安装位置配置)

[client]

port=3306
default-character-set=utf8

[mysqld]
#设置mysql的安装目录
basedir=D:\DevelopInstall\mysql-8.0.11-winx64
#设置mysql的数据目录
datadir=D:\DevelopInstall\mysql-8.0.11-winx64\data

character_set_server=utf8
#sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER
#开启查询缓存
explicit_defaults_for_timestamp=true

3. 以管理员身份运行cmd 进入: mysql-8.0.11-winx64/bin目录下: 执行命令 mysqld –-initialize   

(在data下可以看到.err文件,其中藏有你首次登录root的密码)如:

  A temporary password is generated for root@localhost: Cu/fkq0Mts?t

4. cmd中  执行mysqld install 安装服务,

5.cmd中  net start mysql  启动服务  

6.cmd中  mysql -u root -p 登陆 .err文件中密码粘贴过来用于登陆

win7 /  mysql-8.0.11-winx64 安装的测坑步骤

7.登陆成功。

修改为新密码:ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

  win7 /  mysql-8.0.11-winx64 安装的测坑步骤

mysql> use mysql;

mysql> select user,host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| root | localhost |
+------------------+-----------+

mysql> update user set host='%' where user='root';
Query OK, 1 row affected (0.05 sec)

==============至此安装完毕,可以运程访问了。 下边是另外一条岔路。========================

8*************** 现在我用 Navicat Premium 连接 mysql   提示:Client does not support authentication protocal requested by server;  ...

我以为是root没有允许远程ip连接于是准备赋予权限:

grant all privileges on *.* to root@'%' identified by '123456';

mysql> grant all privileges on *.* to root@'%' identified by '123456';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'ident
ified by '123456'' at line 1

-------------反复执行反复错误,反复百度查询错误提示,并没有什么用处。最后google代理: 一下子就有结果了:

https://*.com/questions/50177216/how-to-grant-all-privileges-to-root-user-in-mysql-8-0

我看了上半段: 大意是grant all privileges on *.* to root@'%' identified by '123456'; 报错啊,mysql8与5.1有差异啊,该怎么赋予权限给root也能被远程ip访问啊。

最后看到

mysql> CREATE USER 'java'@'%' IDENTIFIED BY 'root';

Query OK, 0 rows affected (0.31 sec)

mysql> GRANT ALL PRIVILEGES ON . TO 'java'@'%' WITH GRANT OPTION;

Query OK, 0 rows affected (0.16 sec)

总之,是得创建新用户并且顺便赋予权限。那么我就如上改了'java'@'%' 用户用作为远程连接了。

9.之后还是连不上

Navicat Premium 连接 mysql   提示:Client does not support authentication protocal requested by server;  ...

最后:

https://www.cnblogs.com/xiaojian1/p/mysql.html

alter user 'test'@'%' identified with mysql_native_password by '123';  解决烦恼Navicate可以正常连接了。

虚惊一场,主要问题是 Navicat Premium 连接 mysql8  Client does not support authentication 。