Error: ER_HOST_NOT_PRIVILEGED: Host 'ec2-107-20-54-45.compute-1.amazonaws.com' is not allowed to connect to this MariaDB server


#1

So, I am trying to connect my external database to my bot using the ‘mysql’ Node Package. Previously, I had to flush hosts due to too many connection errors. Now, after doing it again, I am totally locked out.

Error being:
/rbd/pnpm-volume/1356cb30-6b8f-4422-81d2-77d11de3a872/node_modules/.registry.npmjs.org/mysql/2.16.0/node_modules/mysql/lib/protocol/Parser.js:80

throw err; // Rethrow non-MySQL errors
^
Error: ER_HOST_NOT_PRIVILEGED: Host ‘ec2-107-20-54-45.compute-1.amazonaws.com’ is not allowed to connect to this MariaDB server

I hope you can help, thanks.


#2

I would not know a solution to this myself, but I have looked into this some more, and maybe this can help, I am not 100% sure if this will help, but it maybe can help you see the problem you have! https://stackoverflow.com/questions/47270505/er-host-not-privileged-docker-container-fails-to-connect-to-mariadb


#3

Hey @Awestruck, that error message sounds like the host your project is running on hasn’t been granted access to your MySQL server. Depending on how your database is being hosted it’s not unusual to have to whitelist your project’s host with your database service.

If you use the console you can run curl ifconfig.co and you’ll get your current host’s IP address. Keep in mind that this IP address will change every so often and you’ll have to update your whitelist.


#4

Fixed. Thanks for the suggestions guys. Was just a permissions issue on my end!