I just setup a VPS with a Mysql Database on it. I'm able to log into the database in the SSH terminal with mysql -uroot -p however, the python file shown below is unable to form a connection, and errors with Access denied for root@localhost (using password: YES). I'm confused as to why this is happening. I'm 100% sure my password is correct. I'm using mysql.connector
Python file:
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="pwd",
database="db"
)
mycursor = mydb.cursor()
sql = "INSERT INTO test (tests) VALUES (%s)"
val = ("testing")
mycursor.execute(sql, val)
mydb.commit()
I'm a bit new to this DB and VPS stuff, so please bear with me if I don't understand on the first go.
Thanks!