https://blog.csdn.net/piaocoder/article/details/53704126
添加新用户
允许本地 IP 访问 localhost, 127.0.0.1
create user ‘test’@‘localhost’ identified by ‘123456’;
允许外网 IP 访问
create user ‘test’@’%’ identified by ‘123456’;
为新用户分配权限
授予用户通过外网IP对于该数据库的全部权限
grant all privileges on testdb
.* to ‘test’@’%’ identified by ‘123456’;
授予用户在本地服务器对该数据库的全部权限
grant all privileges on testdb
.* to ‘root’@‘localhost’ identified by ‘p6e70e97efa’;
在命令框 远程连接的时候,带上阿里云的服务器
mysql -h47.98.240.236 -uroot -p6e70e97efa