I am doing a test in Python to verify that the database of a machine is active.
My problem is that when I connect it gives me the error:
"sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1045," Access denied for user 'david' @ 'localhost' (using password: NO) ")"
and my code is:
connection = 'sqlite:///'+user+':'+password+'@'+str(host)+':'+str(port)+"/"+dbname
self.engine = sqlalchemy.create_engine(connection) #Establish connection
self.connection = self.engine.connect()
print('Connected to '+connection)
result = self.connection.execute('SELECT COUNT(name) FROM table WHERE name LIKE "%pdf"')
In 'user' I do not have a defined "david", as it appears in the error and as you can see if I use a password.