远程连接报错pymysql.err.OperationalError: (1045

pymysql.err.OperationalError: (1045, "Access denied for user 'iiiii'@'?.?.?.?' (using password: YES)")

先去查看你的表:

select user,host from mysql.user;

看看是不是有用户名为空的用户,有的话干掉它。

因为当你设置了用户a:’user0‘@‘%’

然后你的用户表里面有用户名为空的用户b:‘’@‘localhst’ 

当你用用户a登陆时会与b造成冲突。所以干掉没有用户名的用户,

delete from mysql.user where user='';

关于这点,愿闻其翔:

https://stackoverflow.com/questions/10299148/mysql-error-1045-28000-access-denied-for-user-billlocalhost-using-passw

 

第二步 :

检查一下你的远程登陆账号密码在本机上能不能登陆,能登陆的情况下,确定是不是:不要密码也能登陆(不输密码也能登陆就去删掉这个用户重新创建,貌似再次创建的时候不能用刚删除的那个用户名创建,创建过程见分界线下面)。修复这些问题,你应该就能登陆了的。

 

以上是我解决我的问题的过程,若以上没解决你的问题,请参照以下:

Several possible causes :

  1. the user doesn't have permission to connect remotely
  2. MYSQL is in stopped state at remote server
  3. 3306 port is not allowed in remote server
  4. Your IP is not allowed to access the remote server using http

Check if all of these are true , you should be able to connect

闻其翔传送门

https://stackoverflow.com/questions/30317723/how-to-connect-to-remote-mysql-db-in-yii2

 

 

=========我=是分界线======好==吧==其实==我==也是========等号=============


1.创建用户

创建user01,只能本地访问

      create user user01@'localhost' identified by 'password';


创建user02,可以远程访问

      create user user02@'%' identified by 'password'


2.授权

授予user01管理test的全部权限

       grant all privileges on test.* to user01;


授予user02查看权限,并修改密码

       grant select on *.* to 'user02'@'%' identified by 'password';

       授予所有权限

       GRANT ALL PRIVILEGES ON *.* TO userName@"%" IDENTIFIED BY "uerPassword";

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值