OperationalError - 1044, "Access denied for user 'user'@'%' to database 'user$spendings'"

Hello everyone, This is the first time ever I deploy a Django app, and I have a problem connecting to mysql database, I keep getting the following error 1044, "Access denied for user 'vadimvolkov'@'%' to database 'vadimvolkov$spendings'". I have checked similar topics here and on stackoverflow but none of the recommendations helped. I suspect that something might be wrong with my database settings in, but cannot quite see what exactly. Here are my data database settings:

'ENGINE': 'django.db.backends.mysql',
'NAME': 'vadimvolkov$spendings' ,
'USER': 'vadimvolkov',
'PASSWORD': 'mypasswordhere',

Hmm, I can't see a database called vadimvolkov$spendings associated with your account -- you have a similarly-named one but not one with that exact name. Might that be the problem?

oh, sure! I messed up the name and typed the other one. Sorry, that was silly of me, of course that was the reason.

Glad to help :-)

Hi. Same issue here and I cannot find any configuration issues.

I'm trying to create the database from a ".sql" file running this command: mysql -u SergioQV -h 'SergioQV$cfs' < migration_script.sql

and I'm getting this error: Access denied for user 'SergioQV'@'%' to database 'cfs'

This is an extract of the .sql file, just in case it helps:

-- Schema cfs


-- Table cfs.price

CREATE TABLE IF NOT EXISTS cfs.price ( coin LONGTEXT NOT NULL, base_coin LONGTEXT NOT NULL, price FLOAT NOT NULL, PRIMARY KEY (coin(255), base_coin(255)));

It looks like the SQL script is trying to work on a database called cfs rather then on SergioQV$cfs.

If the script is something you can easily hand-edit, then you can just change the database name in the appropriate places. There might be easier ways to do that, though (hand-editing might be error-prone if it was autogenerated by something). How did you create the script?

I'm using MySQL Workbench, with the connection settings you provided here:

It seems that the migration tool does not use the database I set in "Default Schema", but the filename instead. Anyway, I replaced it manually in the file and it worked. Thanks!

The bad news is that now I'm having other issues with the 'sql' file, because it seems that MySQL Workbench is replacing all my "VARCHAR(x)" columns with "LONGTEXT", which end ups causing problems: "BLOB/TEXT column 'exchange' used in key specification without a key length".

I understand this may be out of your scope, but any help regarding how to easily migrate the database from sqlite to MySQL would be much appreciated!

Thanks for your quick replies

No problem, glad to help!

I can't think of any particular way to make the migration easier, unfortunately -- if it were a Django DB then you could use the dumpdata and loaddata management commands, but if I remember correctly, this database is one that you've created "manually" (that is, with no ORM) -- is that right?

It does look like there are some interesting Google results for "migrate sqlite to mysql" (including some kind of online converter), but I can't vouch for whether they're good or accurate.

ERROR 1044 (42000): Access denied for user 'magrigs'@'%' to database 'internet_banking_system' my issue please help me

Your database name is "magrigs$internet_banking_system" not "internet_banking_system"

Im getting this error when i do flask db upgrade

sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (1044, "Access denied for user 'blackboard'@'%' to database 'blackboard'")

Your database name in your code should match exactly the name that is displayed on "Databases" page, in the "Your databases" section. The name will start with your username, then a dollar sign, and then the name you specified when you created the database, like this: blackboard$something

i put this mysql -u 1234 -h -p '1234$Proyecto'; and the error is the same ERROR 1044 (42000): Access denied for user '1234'@'%' to database 'Proyecto'

where is the error??

Your database is not called Proyecto, it's called proyecto.

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql -u AngelMora -h AngelMora. -p 'AngelMora$' at line 1

don't work...

I am trying to create a simple table, no script, and it keeps getting "access denied" error

The first error is happening because you're running the Bash command to start the MySQL interpreter from inside the MySQL interpreter. If you already have a mysql> prompt, you don't need to run the mysql command.

Regarding the access denied error, what is the exact error message? And what is the command that you're running?

my database name is tubin2255$tododatabase1 but still its showing this error i also changed the password.. still not helping.

How are you connecting with the database?

my error mysql> create database tododatabase; ERROR 1044 (42000): Access denied for user 'ADITHYA1670'@'%' to database 'tododatabase'

You should create databases using the form on the "Databases" page inside PythonAnywhere -- you can't create them from SQL code.

HELLO i have error msg/ Help me pls

django.db.utils.OperationalError: (1044, "Access denied for user 'nurlanbek'@'%' to database 'prodb'"

'ENGINE': 'django.db.backends.mysql',
    'NAME': 'prodb',
    'USER': 'nurlanbek',
    'HOST': '',
    'PORT': '3306',
    'OPTIONS': { 'sql_mode': 'traditional'}

[edit by admin: formatting, redacted password]

Database name is probably nurlanbek$prodb not prodb

nurlanbek$prodb I tried this but the error is the same

First things first, I strongly recommend that you change your MySQL password -- it appeared in the clear in your original forum post, so anyone that saw it before I removed it just now would be able to get access to your database. You can change the password on the "MySQL" tab of the "Databases" page.

Regarding the error, could you make sure that the password you're specifying is exactly the same as the one you provided on the MySQL page -- you can double-check it by looking in the file .my.cnf in your home directory.