Question
"Access denied for user 'root'@'localhost'" during pymysql.connections
I tried to set up a LAMP server by following this article. It was set up without errors and I can “ssh root@localhost” with my password. But when I was ready to test it by going to http://my_server_ip using Firefox, it gave me a sequence of function calls leading up to the error:
In /var/www/test/index.py
15 user=‘root’,
16 passwd='mypasswd’,
=> 17 host='localhost’)
18 c = conn.cursor()
19
host undefined
In in Connect(args=(), *kwargs={'db’: 'example’, 'host’: 'localhost’, 'passwd’: 'mypasswd’, 'user’: 'root’})
88 “”“
89 from .connections import Connection
=> 90 return Connection(args, *kwargs)
91
92 from . import connections as origconn
Connection = <class 'pymysql.connections.Connection’>, args = (), kwargs = {'db’: 'example’, 'host’: 'localhost’, 'passwd’: 'mypasswd’, 'user’: 'root’}
…
697 self.sock = None
698 else:
=> 699 self.connect()
700
701 def createssl_ctx(self, sslp):
self = <pymysql.connections.Connection object>, self.connect = <bound method Connection.connect of <pymysql.connections.Connection object>>
....
errorclass = <class 'pymysql.err.InternalError’>, errno = 1698, errval = "Access denied for user 'root’@'localhost’”
InternalError: (1698, “Access denied for user 'root’@'localhost’”)
Can you please help me with this?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×