孤灯
收藏于2025-06-11
首先在安装目录 下,C:\Program Files\MySQL\MySQL Server 8.1找到my.ini如果没有创建,内容如下
[client]
port=3306
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4
[mysqld]
port=3306
bind-address=0.0.0.0 # 允许远程连接
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
然后登陆到mysql数据库,执行如下步骤:
-- 步骤1:创建用户(如果不存在) CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY 'root';
creat user 'root'@'%' identified by 'root';
-- 步骤2:授予权限
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码';
-- 刷新权限使更改生效 FLUSH PRIVILEGES;
--步骤3:重启mysql服务。
如果dbeaver连接提示密码登陆有问题,用如下
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码';
然后FLUSH PRIVILEGES; 重启下mysql服务。
提示提示Public Key Retrieval is not allowed时,