阿里云服务器MySQL开启远程访问的一些操作

1、登录MySQL: 输入用户名(一般为 root)——》 回车

# mysql -uroot -p

和密码   ——》

Enter password: (隐藏式的)

2、使用MySQL系统中的的数据库(mysql)

use mysql;

3、查看用户表:host,user,password

mysql> select host,user,password from user;
+-----------+------+-------------------------------------------+
| host      | user | password                                  |
+-----------+------+-------------------------------------------+
| localhost | root | *57E6E125B1C814D6AE8F1AA862EF4865C40B0484 |
| 127.0.0.1 | root | *57E6E125B1C814D6AE8F1AA862EF4865C40B0484 |
| ::1       | root | *57E6E125B1C814D6AE8F1AA862EF4865C40B0484 |
+-----------+------+-------------------------------------------+
3 rows in set (0.00 sec)

4、更新用户表的host

mysql> update user set `host` = '%'  where `user` = 'root'  LIMIT 1;

5、设置新密码

mysql> UPDATE user SET password=PASSWORD("你的新密码") WHERE user='root' LIMIT 1;

6、刷新权限

mysql> flush privileges;

7、退出

mysql> exit;

8、查看3306端口状态

netstat -an|grep 3306

9、查看阿里云的开放端口:登录阿里云进入控制台,依次访问 实例 ->(升降配下的)更多 -> 网络和安全组 -> 安全组配置 -> 配置规则

猜你喜欢

转载自blog.csdn.net/qq_41408081/article/details/84894661