0

I am curently developping a python discord bot using a mysql database for the storage of informations. When I'm testing, I often have a lot of little bugs so I quickly resolve a bug, restart the programm to see the bugs that are left, solve one again. I work a bit like that and sometimes for no particular reason, the connection to the database would just not work. If I wait someting like 3-4 minutes it eventually rework again. It's a bit annoying because it slow me down a lot. This issue seems like there is a cooldown or something that I am not aware of and this is why I'm asking here. Is there something like that and is it possible to disable it ?

This is the code I use to establish the connection :

cnx = mysql.connector.connect(
    user=config.user,
    password=config.word,
    host=config.ip,
    database='database_name')
cnx.autocommit = True

I use the library mysql connector

Note : The account I'm connecting with to the database is the root account so there should be no limitations. Other note : My connection is a local connection. The database is hosted on my computer

This is the error I get :

mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user 'root'@'192.168.0.105' (using password: YES)
Titouan
  • 531
  • 4
  • 13
  • Is your connection local? – P.Salmon Jun 26 '20 at 13:07
  • You might try checking out: https://stackoverflow.com/questions/41645309/mysql-error-access-denied-for-user-rootlocalhost or https://stackoverflow.com/questions/6081339/access-denied-for-user-rootlocalhost-using-password-yes-mysqlerror – manny Jun 26 '20 at 13:09
  • Yes it is local – Titouan Jun 26 '20 at 13:10
  • I looked at the links but it seem that they couldn't, not at all, connect their code with the database. It is different for me because most of the time my programm connect... – Titouan Jun 26 '20 at 13:13
  • 1
    You could try using "localhost" as the host rather than the IP address, to rule out problems caused by the network or firewalls. Note that you'd need to ensure that permissions are set up for root@localhost. – snakecharmerb Jun 26 '20 at 14:20
  • But i will try coding with "localhost" instead. It may work – Titouan Jun 26 '20 at 15:10

1 Answers1

0

The solution of @snakecharmerb worked for me. I had to replace the ip adress of my computer with "localhost" to counter any firewalls or network related problems. Thank's again !

Titouan
  • 531
  • 4
  • 13