Forums

MySQL Exception on Django

Hi, guys,

I'm building an app in Django and everytime I try to run the command python manage.py syncdb I receive the following message

_mysql_exceptions.OperationalError: (1044, "Access denied for user 'lucasloami'@'%' to database ' lucasloami$ensight'")

But this is really strange, I started my MySQL and asked to show all the grants (show grants) and the result is:

+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for lucasloami@% |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'lucasloami'@'%' IDENTIFIED BY PASSWORD  '*538CEF1BB78A17A9CE7F478776D67D390AFE13CA' WITH MAX_USER_CONNECTIONS 12 |
| GRANT ALL PRIVILEGES ON `lucasloami$ensight`.* TO 'lucasloami'@'%' |

I recentl changed the user password but I made sure that the Django configurations had the new password before run the syncdb. I'm not sure why this is happening. Can you help me?

Do you need to 'Reload' your web app perhaps?

That is weird -- syncdb comes from the command-line, so it should work straight away... All I can suggest is to try changing the password again, and making sure there were no copy/paste errors transferring it between the web UI and your django settings?

I presume mysql consoles work ok?

I can open the MySQL console correctly if I connect using my credentials and The host but no database. But if I try to connect to this specific database (mysql -u lucasloami -p -h mysql.server -D database_name ) I receive a similar error.

What if you try and create a new database?

Nevermind, I figured out the error. When I put the database name I accidentally let a small space before the first letter.

OK, thanks for confirming!