0

I have a Django application that is running just fine on two other servers. It is using MySQL as the database.

I have the user setup for a new instance of the application on a new server so that I can successfully connection via the mysql command line client to the remote database.

However, when I attempt to run ./manage.py syncdb, it tell me:

django.db.utils.OperationalError: (1045, "Access denied for user 'app_user'@'mynewserver.com' (using password: YES)")

Every place I've looked online tell me to make sure the user is setup in mysql and has permission to the new database and even to run flush privileges;. I have double checked all of those and done this multiple times. That doesn't seem to be the issue.

Any thoughts?

EDIT

Also, I just checked and running the following from the python command line works fine too:

conn = mysql.connect(host='mynewserver.com', user='app_user', passwd='secret', db='myapp').cursor(mysql.cursors.DictCursor)

EDIT 2

I just ran ./manage.py sql myapp > myapp.sql; ./manage.py dbshell < myapp.sql

Everything worked, it created the tables just fine. I'm assuming that would use the same permissions and settings as running ./manage.py syncdb. What gives?!?

Versions

  • Python==2.7.6
  • Django==1.6.1

EDIT 3

I guess I should also add that I am using South==0.7.6. If that helps.

Walid Naceri
  • 102
  • 9
chadgh
  • 9,063
  • 8
  • 38
  • 54
  • 1
    check privileges of app_user make sure it has read/write permissions – Sam Feb 28 '14 at 23:08
  • Also just confirmed, I can manually create tables, insert into tables, and select things from those tables with the same user that I'm trying to run syncdb with. syncdb is the only thing giving me grief. – chadgh Feb 28 '14 at 23:13

1 Answers1

1

I did leave something out that I didn't think was relevant, but is totally relevant.

This application has multiple databases defined. Syncdb only runs on one database at a time, and by default will run using the default database, as noted here: https://docs.djangoproject.com/en/1.6/topics/db/multi-db/#synchronizing-your-databases

However, when my user didn't have permission on the other database syncdb would fail. It didn't indicate which database it was trying to access.

Running ./manage.py reset_db from django-extensions, worked fine as well, before I made sure that the user had permissions on all databases.

I would assume then that there is a bug in syncdb. After more looking into this, I might have to report a bug to Django.

chadgh
  • 9,063
  • 8
  • 38
  • 54