温馨提示×

ubuntu下mysql连接失败怎么办

九三
282
2021-01-05 09:15:48
栏目: 云计算
亿速云mysql数据库,读写分离,安全稳定,弹性扩容,低至0.3元/天!! 点击查看>>

ubuntu下mysql连接失败怎么办

ubuntu中连接mysql失败的解决方法

原因:Ubuntu在mysql的配置文件中默认绑定了本机ip,需要修改配置文件并赋予权限。

1.在ubuntu命令行中,打开my.cnf配置文件;

/etc/mysql/my.cnf

2.my.cnf配置文件打开后,在文件进行以下修改:

# Instead of skip-networking the default is now to listen only on

# localhost which is more compatible and is not less secure.

bind-address = 127.0.0.1

3.my.cnf配置文件修改好后,使用service命令启动MySQL;

service mysql start

4.最后,MySQL启动后,使用root用户即可连接到MySQL;

mysql -u root -p

亿速云「云数据库 MySQL」免部署即开即用,比自行安装部署数据库高出1倍以上的性能,双节点冗余防止单节点故障,数据自动定期备份随时恢复。点击查看>>

推荐阅读:ubuntu下securecrt连接失败怎么办

0