sqlalchemy connect to VPS database

2019-09-10 07:47发布

I am trying to connect to VPS mysql database from my PC. I use sqlalchemy framework, but I need establish SSH tunnel before connection.

Usual way, when web app run on VPS:

create_engine('mysql://user:pswd@localhost/dbname')

How can I connect to this database from another PC. Assume there are connections credentials: IP, username, password

1条回答
Fickle 薄情
2楼-- · 2019-09-10 08:33

Your MySQL server is listening to local connections only. To make it listen to outside connections:

  1. Edit the /etc/mysl/my.cnf file
  2. Comment out the line bind-address = 127.0.0.1
  3. Restart mysqld
查看更多
登录 后发表回答