Reputation: 1887
I want to connect to my database from Python shell
import MySQLdb
db = MySQLdb.connect(host="localhost",user="milenko",passwd="********",db="classicmodels")
But
File "/home/milenko/anaconda3/lib/python3.6/site-packages/MySQLdb/connections.py", line 204, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'milenko'@'localhost' (using password: YES)")
I have created user
CREATE USER 'milenko'@'localhost' IDENTIFIED BY '8888888';
but still the problem is still there. Databases
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| ap1 |
| classicmodels |
| mysql |
| performance_schema |
| sys |
+--------------------+
6 rows in set (0.00 sec)
What does this mean?How to resolve this problem?
Upvotes: 1
Views: 6112
Reputation: 2909
this generally means you do not have permissions to access the server from that particular machine. to fix it, either create user 'milenko'@'localhost' or 'milenko'@'%' using your root server user
OR
grant your user privileges on that particular db
Upvotes: 2