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()
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()