阿里云mysql远程连接

阿里云服务器

首先确保 阿里云 ECS防火墙设置


开放mysql端口


 输入 root@DB-02 ~]# mysql -u root -p 回车提示

-bash: mysql: command not found

首先,查看$PATH中是否包含了这些命令。

[root@localhost /]# echo $PATH

发现缺少mysql执行路径

建议通过编辑/etc/profile 修改PATH

扫描二维码关注公众号,回复: 2060460 查看本文章

也可修改/home目录下的 .bashrc

[root@localhost etc]# vim /etc/profile
在文件末尾添加   注意是mysql路径的bin目录
export PATH="/usr/local/mysql//bin:$PATH"

 保存后,退出,执行:

1 [root@localhost etc]# source /etc/profile

不报错就成功。

局域网访问不到的情况解决方法

为了安全,首先需要设置root帐号的密码

update user set authentication_string = password('root') where user = 'root';

mysql> grant all privileges on *.* to root@"%" identified by "password" with grant option; 

Query OK, 0 rows affected, 1 warning (0.04 sec)
mysql> flush privileges; 

Query OK, 0 rows affected (0.00 sec

远程就可以访问了


java分享交流群 110408216  java分享交流群



猜你喜欢

转载自blog.csdn.net/zxb730916/article/details/79682956