python连接远程mysql数据库 拒绝

flask 创建数据库时,出现mysql服务拒绝 ,发现是没有开启mysql远程连接配置 ,记录下解决方法

1、修改服务器ubuntu下mysql配置文件

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

bind-address =127.0.0.1

更改为

bind-address =0.0.0.0

2、支持root账号远程连接mysql数据库

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush privileges;

3、查看结果

 

posted @ 2019-03-28 16:41  delinem  阅读(841)  评论(0编辑  收藏  举报