requesting your support to find the reason why my Python code does not connect to a Server other than Localhost mounted on XAMPP. The error it throws is about my IP address, not so much about the server's. Annex code and error output. Greetings!
"""
Conexión a base de datos MySQL
"""
import MySQLdb
from os import listdir
#Definimos valores para la conexión
db_Host = '1XX.XXX.XX.227'
db_User = 'root'
db_Pass = ''
db_Name = 'desbordes'
#Función de conexión
datos = [db_Host, db_User, db_Pass, db_Name]
#creamos la conexión
conn = MySQLdb.connect(*datos)
cursor = conn.cursor()
with open('C:/ruta/archivo.txt', mode='r',encoding='utf-8') as entrada:
conteo_bc1 = 0
#Ciclo que lee cada linea en el archivo Bcom
for linea in entrada:
if "CASH" in linea:
conteo_bc1 += 1
query = 'INSERT INTO Bcom (fecha, menu, total_desbordes) VALUES ("{}","{}","{}")'.format(fecha,"CASH",conteo_bc1)
cursor.execute(query)
conn.commit()
conn.close()
When executing the script, I get the following output:
.OperationalError: (1130, "Host 'mi_IP' is not allowed to connect to this MySQL server")