Version: 3.5.0
I'm trying to validate my connection via MySQLDatabase on a fresh MySQL server (added a user with permission to specified database) but it's not accepting a password:
>>> db = MySQLDatabase('database', user='username', password='***')
>>> db.get_tables()
(1045, "Access denied for user 'username'@'localhost' (using password: NO)")
I checked db.__dict__['connect_params']['password'] and it exist there.This differs from another MySQL server which uses [email protected], succeeds to connect.
Can you connect to this database directly without peewee?
@natku
Yes, I can access the database as root and other users.
I've tried the MySQLDatabase with other users as well.
Have you tried using passwd instead of password for the password field?
@coleifer
Yes I have
What MySQL driver are you using? Are you able to connect to the database using the driver directly? (e.g. pymysql, mysql-connector, etc)
Since I haven't heard anything I am closing. Please comment with answers to my questions and I'll happily reopen if there is still an issue.
@coleifer
Sorry for the late response, couldn't test out your question until the next weekday. Seems like pymysql returns the same error. So the root error doesn't seem to be peewee. Any suggestions?
>>> pymysql.connect(db='database', user='username', password='***')
(1045, "Access denied for user 'intern'@'localhost' (using password: NO)")
Do you recommend any other MySQL drivers for Python 3 since documentation only mentions pymysql (MySQLdb isn't going to work)?
===
Here's the problem PyMySQL #651, when setting up mysql I was using SHA256 auth.
Thanks for the edit homie...that's interesting. So sounds like a pymysql + mysql 8 / sha256 bug? You can use the de-facto mysql driver, "mysql-connector" with py3k if you wish. e.g.:
https://github.com/coleifer/peewee/blob/master/playhouse/mysql_ext.py
I had exact the same issue with
>>> pymysql.__version__
'0.8.0'
and simple upgrade pip install pymysql --upgrade to 0.9.3 version resolved it.
I had exact the same issue with
>>> pymysql.__version__ '0.8.0'and simple upgrade
pip install pymysql --upgradeto0.9.3version resolved it.
this worked, its seems there is some issue with the version 0.8.0/0.8.1. upgrading the package is working for me. Thanks!
im getting Failed to connect to MySQL: Access denied for user ''@'localhost' (using password: NO)Wrong Username or Password error when i run one project in xampp 7.3.11 please help me to solve this error
Are you able to connect to the mysql database using the mysql shell? You may need to explicitly pass your username to the database when setting up the connection.
yes
On Thu, Nov 14, 2019 at 8:05 PM Charles Leifer notifications@github.com
wrote:
Are you able to connect to the mysql database using the mysql shell?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/coleifer/peewee/issues/1626?email_source=notifications&email_token=ANXMUXMFB3FM23KWFNL5XDLQTVOZHA5CNFSM4FDYM3YKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEECBA2I#issuecomment-553914473,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ANXMUXKPO5X3MSXFVQVTSETQTVOZHANCNFSM4FDYM3YA
.
Most helpful comment
I had exact the same issue with
and simple upgrade
pip install pymysql --upgradeto0.9.3version resolved it.