1. When you plan to open your database with MySQL – H (IP address of host) – U (user name) – P, the error host ‘is not allowed to connect to this MySQL server is reported
reason: remote login is not allowed in MySQL Step 1: MySQL – U (user name) – P
Step 2: enter use MySQL
Step 3: enter update user set host = ‘%’ where user =’root ‘
4. After connecting, test example:
import pymysql
#Establish a connection
conn = pymysql. Connect (
0 Host =
your IP address user=”root”, # User name
Passwd = “root”, # user password
0 DB = (test) # database name
#To create a cursor, the default is meta group type
cursor = conn.cursor()
sql = “select * from student” # the name of the table in the database
cursor.execute(sql)
res = cursor.fetchall()
print(res)
cursor.close()
conn.close()
Read More:
- How to Fix MySQL ERROR 1130 (HY000): Host ‘XXXX’ is not allowed to connect to this MySQL server
- [Solved] Error: ER_HOST_NOT_PRIVILEGED: Host ‘x.x.x.x‘ is not allowed to connect to this MySQL server
- Remote connection to MySQL database error: is not allowed to connect to this MYSQL server solution
- [Solved] ERROR 2002 (HY000): Can’t connect to local MySQL server through socket’/var/lib/mysql/mysql.sock’ (2)
- [Solved] MYSQL Command Execute Error: Can ‘t connect to local MySQL server through socket ‘/tmp/mysql.sock ‘(2) “
- MySql Install Error: Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘
- How to Solve can‘t connect to local mysql server through socket ‘/var/lib/mysql/mysql.sock‘
- MYSQL Enter password:ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost:3306‘
- ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
- Ubuntu ERROR 2003 (HY000): Can’t connect to MySQL server on ‘127.0.0.1’ (111)
- MySQL Install Error: MySQL error 1042: Unable to connect to any of the specified MySQL hosts
- ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’
- How to Solve c3p0 connect mysql8.0 Error
- C# Connect MYSQL Error: MySql.Data.MySqlClient.MySqlException:“SSL Connection error.”
- [Solved] Anaconda Error: pyqt can’t use QSqlDatabase to connect to MySQL
- Using Mybatis to connect to the database error: Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver···
- Mysql Flashback Warning: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe
- (Fixed) workbench MySQL Error Code: 2013. Lost connection to MySQL server during query
- [Solved] mysqldump Command Error: Got error: 2002: “Can‘t connect to server on ‘127.0.0.1‘ (36)“ when trying to connect
- SqlSugar Connect MySql 8.0.29 Error [How to Solve]