So I\'m learning Django (1, 3, 1, \'final\', 0) through this resource: http://www.djangobook.com/en/2.0/chapter05/
I installed \'mysql-server\' and \'python-mysqldb\
I also ran into this problem while following the Django tutorial on testing (https://docs.djangoproject.com/en/dev/intro/tutorial05/). When trying to test the polls app, I received the following error:
user@host:~/django/mysite$ python manage.py test polls
Creating test database for alias 'default'...
Got an error creating the test database: (1044, "Access denied for user 'admin'@'localhost' to database 'test_django_mysite'")
Type 'yes' if you would like to try deleting the test database 'test_django_mysite', or 'no' to cancel:
The problem is that django is creating a temporary database called test_django_mysite.
I was able to solve this problem by granting access to 'admin'@'localhost' on the test_django_mysite database that it was trying to create.
mysql> GRANT ALL PRIVILEGES ON test_django_mysite.* TO admin@localhost IDENTIFIED BY 'mypassword';
Query OK, 0 rows affected (0.04 sec)
It's worth noting that I only granted the privileges to test_django_mysite. I didn't need to actually create it.