Problems encountered in getting started with Mysql database

python mysql library installation:

pip install sqlalchemy

apt-get install python-mysqldb

 

We connect to the mysql of the remote server. If there is a problem, the big problem will be the port and authorization of the server.

 

First we pass

①:netstat -an|grep 3306

To see if the default port 3306 of mysql is open, which ip is allowed to use, if you find that there is 127.0.0.1 in front, it means that port 3306 can only be used by the local ip

So, we need

②: Open the mysql configuration file vi /etc/mysql/mysql.conf.d/mysqld.cnf

logout bind-address = 127.0.0.1​

③: Enter mysql, authorize the remote user,

grant all privileges on *.* to 'root'@'%' identified by 'xxxxxx';

The root here is the user you log in remotely, xxxxxx is the password you use to log in, and then you can see in the mysql data table that your user has been added to the user table

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326262475&siteId=291194637