Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#5776 closed (fixed)

Conflict between tutorial and 'Get your database running' section of the 'How to install Django' page

Reported by: Jeff@… Owned by: nobody
Component: Documentation Version: dev
Severity: Keywords: mysql
Cc: Triage Stage: Someday/Maybe
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This snippet from the 'Get your database running' section of the 'How to install Django' page specifies a limited set of permissions needed for the database user:

If you plan to use Django’s manage.py syncdb command to automatically create database tables for your models, you’ll need to ensure that Django has permission to create tables in the database you’re using; if you plan to manually create the tables, you can simply grant Django SELECT, INSERT, UPDATE and DELETE permissions. Django does not issue ALTER TABLE statements, and so will not require permission to do so. If you will be using Django’s testing framework with data fixtures, Django will need permission to create a temporary test database.


However running through the tutorial caused these errors that were corrected by adding ALTER and INDEX permissions:

prompt:~/development/tutsite XXX$ python2.4 manage.py syncdb

Creating table auth_message
Creating table auth_group
Creating table auth_user
Traceback (most recent call last):

File "manage.py", line 11, in ?

execute_manager(settings)

File "/opt/local/lib/python2.4/site-packages/django/core/management.py", line 1672, in execute_manager

execute_from_command_line(action_mapping, argv)

File "/opt/local/lib/python2.4/site-packages/django/core/management.py", line 1571, in execute_from_command_line

action_mapping[action](int(options.verbosity), options.interactive)

File "/opt/local/lib/python2.4/site-packages/django/core/management.py", line 534, in syncdb

cursor.execute(statement)

File "/opt/local/lib/python2.4/site-packages/django/db/backends/util.py", line 12, in execute

return self.cursor.execute(sql, params)

File "/opt/local/lib/python2.4/site-packages/MySQLdb/cursors.py", line 163, in execute

self.errorhandler(self, exc, value)

File "/opt/local/lib/python2.4/site-packages/MySQLdb/connections.py", line 35, in defaulterrorhandler

raise errorclass, errorvalue

_mysql_exceptions.OperationalError: (1142, "ALTER command denied to user 'django'@'localhost' for table 'auth_message'")

------------------------

prompt:~/development/tutsite XXX$ python2.4 manage.py syncdb
Creating table auth_permission
Creating table django_content_type
Creating table django_session
Creating table django_site
Installing index for auth.Permission model
Failed to install index for auth.Permission model: (1142, "INDEX command denied to user 'django'@'localhost' for table 'auth_permission'")Loading 'initial_data' fixtures...
No fixtures found.

Attachments (4)

5776.diff (873 bytes ) - added by arien <regexbot@…> 17 years ago.
5776-alternative.diff (904 bytes ) - added by arien <regexbot@…> 17 years ago.
5776-another-possibility.txt (361 bytes ) - added by Jeff@… 17 years ago.
Another possible edit …
5776.mysql_index.diff (1.0 KB ) - added by Lou Quillio <public@…> 17 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by Chris Beaven, 17 years ago

Triage Stage: UnreviewedAccepted

The documentation says there "if you plan to manually create the tables". Using syncdb isn't manually creating them.

I guess the following sentence which mentions no need for ALTER TABLE isn't clearly linked to the previous sentence. If you think you car write it clearer, give it a go and attach the patch!

by arien <regexbot@…>, 17 years ago

Attachment: 5776.diff added

by arien <regexbot@…>, 17 years ago

Attachment: 5776-alternative.diff added

comment:2 by arien <regexbot@…>, 17 years ago

Has patch: set

Either of these two patches will do, I think.

(The first patch changes the wording, while the second only changes punctuation.)

comment:3 by Jeff@…, 17 years ago

I'm just getting back to this, and it looks like I'm late.

I'm also new to Django and this ticket system so I don't know how to attach the a diff file for this.

I think a better solution might be to split it into two paraagraphs. One for automatically created table permission requirements, and the other for manually created database tables.

I still find the sentence about 'no ALTER permission' is needed by Django. It still looks like it is required by Django, but only if you're using syncdb to manage tables. Its not required if you manually manage the tables. Am I missing soemthing here ?

by Jeff@…, 17 years ago

Another possible edit ...

comment:4 by James Bennett, 17 years ago

Resolution: fixed
Status: newclosed

(In [6794]) Fixed #5776: Added an explanation of when and why Django might need ALTER TABLE privileges to docs/install.txt

comment:5 by Lou Quillio <public@…>, 17 years ago

Keywords: mysql added
Triage Stage: AcceptedSomeday/Maybe
Version: 0.96SVN

When using syncdb with models.ForeignKey() against MySQL 5.0, I found that the MySQL user also needs INDEX. Not sure how ambitious install.txt means to be with edge cases, but there's a patch attached just the same.

LQ

by Lou Quillio <public@…>, 17 years ago

Attachment: 5776.mysql_index.diff added
Note: See TracTickets for help on using tickets.
Back to Top