Forums

Create a superuser

Hi I have my site up and running using mysql for my database, I am trying to create a superuser, but am having trouble so can any anyone help me I open a console on the database that I am using, in this case Heidi_Recipe_Webpage

I then viewed the tables as follows Tables_in_tonydav43$Heidi_Recipe_Webpage |

+------------------------------------------+

| accounts_account |

| auth_group |

| auth_group_permissions |

| auth_permission |

| django_admin_log |

| django_content_type |

| django_migrations |

| django_session |

| recipes_app_recipe

If I view the permissions for me (tonydav43), I see

Grants for tonydav43@%
| +--------------------------------------------------------------------------------+

| GRANT USAGE ON . TO 'tonydav43'@'%' |

| GRANT ALL PRIVILEGES ON tonydav43$default.* TO 'tonydav43'@'%' |

| GRANT ALL PRIVILEGES ON tonydav43$Database_For_Heidi.* TO 'tonydav43'@'%' |

| GRANT ALL PRIVILEGES ON tonydav43$Heidi_Recipe_Webpage.* TO 'tonydav43'@'%' |

| GRANT ALL PRIVILEGES ON tonydav43$Heidi_Recipe_Database.* TO 'tonydav43'@'%'

If I view the accounts column, I see that I have 2 users (1 of them being me) but I have a 0 against: is admin is staff is superuser I want to become a superuser

If I go to create a superuser using my user name etc, I get the following error

CREATE USER 'tonydav43'@'%' IDENTIFIED BY my password here'; ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation I did create a superuser in the bash terminal as tonydav43 in the project directory and the other was created via the website

So I have 2 questions as follows: 1. how do I make myself a superuser? 2. As I have dropped the 3 of my databases, how can I remove the privileges from: tonydav43$default tonydav43$Database_For_Heidi tonydav43$Heidi_Recipe_Database

You cannot create a superuser on MySQL on PythonAnywhere.

Thanks, so how do I go about deleting a user or an instance in my database, say someone has created an offensive post in the website that has a mysql database attached to it

That would just be a record in the database and that you can delete from the appropriate table. You do not need superuser permissions to delete a record. If you're using Django, you can probably also do it through the admin interface.

That would just be a record in the database and that you can delete from the appropriate table. You do not need superuser permissions to delete a record. If you're using Django, you can probably also do it through the admin interface.