Forums

1044, _Access denied for user 'premierbdevelope'@'%' to database 'help'_)

I hate to re-hash this subject but I'm not making progress on it by reading and implementing solutions in the other posts:

Here is the error message: mysql_exceptions.OperationalError: (1044, "Access denied for user 'premierbdevelope'@'%' to database 'help'")

Here is the code:

import requests
import MySQLdb
from bs4 import BeautifulSoup
import json
import pprint

conn = MySQLdb.connect("premierbdeveloper.mysql.pythonanywhere-services.com", "premierbdevelope", "mypassword01", "premierbdevelope$help")
cur = conn.cursor()
cur.execute("USE help")

When I try to execute this portion of the code I get the error message above:

it should probably be USE premierbdevelope$help

I am gettting the same error even when I use the 'my_user_name$my_database'. My connection string is

mysql://erickpinheiro:<password>@erickpinheiro.mysql.pythonanywhere-services.com/'erickpinheiro$farmaco'

and the error:

mysql_exceptions.OperationalError: (1044, "Access denied for user 'erickpinheiro'@'%' to database 'erickpinheiro$farmaco'")

Is there some explanation for this? Thanks.

the first thing to check would be: can you open a MySQL console from your PythonAnywhere database tab?

Thanks Conrad. The solution provided on 8/21 worked for me.

Conrad sure, I can open a MySQL console from your PythonAnywhere database tab and through bash console as well. I've already checked my password, username and database name and all of them are correct.

I would perhaps also try to reset your password and not use any special characters (eg: nonASCII unicode, / escape characters etc)

I already tried everything that you suggested. It can be the MySql version? Because on my machine I use MySql 5.7 (the only release that worked).

No, I don't think it's a MySQL version problem -- you'd at least be able to connect to the database.

I see that you've put single quotes around the database name in your connection string -- might that be the problem? They should not be there.

Without the single quotes I get that message: Invalid hostname Because the dollar ($) it'll be understood as enviroment variable.

$ sign is not interpreted as environment in python strings, there are other things that have special meaning (c-style placeholders %s, %d, ...)

Ah sorry then, but the thing is that I still cannot connect to the database. I've tried everything listed below:

  1. Change database password.
  2. Consider database name with/without quotes adoting the pattern <user_name>$<database_name>.
  3. Check if I can connect to database from the console (Yes, I can)
  4. Try to grant all permitions to my user (I get the same error).

But even though I'm still getting the error:

(1044, "Access denied for user 'erickpinheiro'@'%' to database 'erickpinheiro$farmaco'")

So I don't know what is going on, once I can connect seamlessly on my local database (MySql 5.7).

This is the correct connection string:

mysql://erickpinheiro:<password>@erickpinheiro.mysql.pythonanywhere-services.com/erickpinheiro$farmaco

assuming you've replaced <password> with the correct password.