S
S
Sketch0072018-03-10 22:14:47
MySQL
Sketch007, 2018-03-10 22:14:47

How to fix error 1045 when connecting to MySQL via Python?

Created a MySQL database, trying to join it via below code

import _mysql

def main():

    db=_mysql.connect()
    db = _mysql.connect(host="localhost", user="admin",passwrd="пароль от бд, который я вводил при установке" db="clients")
    print(db)

if __name__ == '__main__':
    main()

Where user is the user I created by giving him all rights.
But it brings me
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'ODBC'@'localhost' (using password: NO)")

Looked it up on Google, they all had their usernames that they enter, but for some reason I have ODBC.
I also thought the problem was in the word Passwrd, but no.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
ma3xak, 2018-03-10
@ma3xak

mysql -uroot -pROOTPASSWORD
Try like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question