0

Following a tutorial on youtube on how to set up and use the DjangoFramework. Tried running python manage.py migrate but I ran into this error and I'm unable to figure out a solution to it. Using mysqlclient and running on a virtual environment and on MACOS

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

I don't know if this would be the issue, but I created a database on using the myphpadmin on http://localhost:8080/phpmyadmin/. localhost/phpmyadmin does not work.

The code for DATABASES in settings.py is as follows :

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'djangoproject', 'USER' : 'root', 'PASSWORD' : 'rootpassword', 'HOST': 'localhost', 'PORT' : '' , } } 
12
  • did you update your settings.py? Commented Nov 13, 2018 at 16:34
  • edited the post. does updating settings.py mean putting values like i shown in the DATABASES ? Commented Nov 13, 2018 at 16:35
  • port is 3306 . Commented Nov 13, 2018 at 16:36
  • @Stack Tried that but it still gave the same error Commented Nov 13, 2018 at 16:37
  • did you create a database named djangoproject in mysql Commented Nov 13, 2018 at 16:38

1 Answer 1

1

If you are connecting with phpmyadmin by default no password set. And also write port number.

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'djangoproject', 'USER' : 'root', 'PASSWORD' : '', 'HOST': 'localhost', 'PORT' : '3306' , } 

Change password of phpmyadmin

Sign up to request clarification or add additional context in comments.

9 Comments

Tried this. Gave me the same error with (using password :NO) instead
@bernardang go to phpmyadmin dashboard click the User accounts tab then check User name 'root' and Host 'localhost' then Edit privileges of this account. Then change password of this account.
Was I supposed to change it to what I put it as in the DATABASES code ?I did that and now I am getting Access Denied error. "phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server."
I have actually gotten it to work. by changing the settings on XAMPP. However, I still cant get phpmyadmin to work on localhost/phpmyadmin or localhost:8000/phpmyadmin where the server on my django app is run on.Any fix to this?
[Access denied error solution. ](stackoverflow.com/questions/19482371/…)
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.