MySQL Forums
Forum List  »  Connector/Python

Error in Database connectivity with python3.7
Posted by: srm modi
Date: May 08, 2019 02:07AM

pymysql.err.OperationalError: (1045, "Access denied for user 'root@localhost'@'localhost' (using password: YES)")
not able to connect to mysql database from python 3.7.2
the code is as bewlow:
import pymysql
conn=pymysql.connect('localhost','root@localhost','mcse@123','mysqldb')
if not conn!=None:
print("Connection Succeeded")
cmd=conn.cursor()
cmd.execute('create table emp(empid int,empname char(10))')
conn.close()
cmd=conn.cursor()
cmd.execute("insert into emp values(111,'asha')")
conn.commit()
conn.close()
cmd.cursor()
cmd.execute('select * from emp')
result=cmd.fetchall()
for i in result:
print(i)
conn.close()

Options: ReplyQuote


Subject
Written By
Posted
Error in Database connectivity with python3.7
May 08, 2019 02:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.