版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_35213388/article/details/80287764
1.新建my.ini和data文件夹
创建my.ini 复制以下内容,注意修改路径,创建data文件夹
代码语言:javascript复制
-
[mysqld]
-
basedir=E:/Program Files/MySQL/MySQL Server 8.0
-
datadir=E:/Program Files/MySQL/MySQL Server 8.0/data
-
port = 3306
-
character-set-server=utf8
-
#忘记密码时使用
-
#skip-grant-tables
-
#设置协议认证方式
-
default_authentication_plugin=mysql_native_password
-
[mysql]
-
default-character-set=utf8
2.将mysql数据库user表里的root用户的host改成%
update user set host='%' where user='root';
3.允许root用户远程访问
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '密码' WITH GRANT OPTION;
4.Navicat11连接mysql8报错Client does not support authentication protocol requested by server; consider upgrading MySQL client
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '密码';
FLUSH PRIVILEGES;