During use pymysql, we must first set up a database to be accessed.
First, in both cases, the database can not be accessed
mysql remote access must be enabled to allow remote connections root account is not remote login, you can only log on locally
1, cheney database
use cheney
2, add users to allow connections from any host server mysql
Allow any ip address (% above what it means) computer using the root user and root for the password to access the mysql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
For example, if you want to allow root from ip: 192.168.1.1 hosts to connect to mysql server and use root as the password, you should write this line of code above
3, in time to take effect
Meaning of this code is to make your code before the entry into force
FLUSH PRIVILEGES;
4, screenshots
Specific operation is as follows, failed because the middle of the colon in Chinese