报错ERROR 1820 (HY000),无法远程连接阿里云服务器

首先,报错那个

可以登陆,但是无论我输入什么都会报错:

mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> use test;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> select version();
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user user() identified by "123456";
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> SET PASSWORD = PASSWORD('123456');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

翻译一下,1820的报错是你必须重置你的密码什么什么的;1819的报错是你的密码不符合它的规范。大概这个意思。

接下来先解决这个问题:

mysql -u root -p

输入密码登陆

然后输入下面语句

mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_length=1;
Query OK, 0 rows affected (0.00 sec)

mysql> alter user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.02 sec)
 

你可以发现你可以实行语句了

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.10 sec)

 

这拒绝了第一个问题,第二个问题是无法连接远程服务器,这其中一种可能就是你没有设置服务器里面的3036端口,这个你买的服务器里面有教你怎么设置的。接下来我要讲的的没有权限这种可能:

你要给你的哪个用户设置远程的权限:

我这个是给root这个用户赋予权限

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)
刷新:

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

查看

mysql> SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
+------------------------------------+
| query                              |
+------------------------------------+
| User: 'root'@'%';                  |
+------------------------------------+
5 rows in set (0.00 sec)
即能你刚刚设置的。

然后你再本地上连接服务器,输入名字跟密码,就能登陆了:

 

服务器端口设置:

 

 

 

 

 

 

 

 

 

 

 


 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值