python3 连接 MySQL 数据库问题, win10 在 cmd 上可以使用 root 加 pssword 连上 mysql,mysql -u root -p password; 但是使用 PyMySQL 却连接不上,报 pymysql.err.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: NO)")
CMD 可以连接
Microsoft Windows [版本 10.0.16299.371] (c) 2017 Microsoft Corporation。保留所有权利。
C:\Users\shuer>mysql -u root -p Enter password: *************** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 52 Server version: 8.0.11 MySQL Community Server - GPL
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
1
GooMS 2018-04-27 01:35:19 +08:00 via Android
Use password no ?
|
2
HanYang1 OP @GooMS 使得,我 cmd 上可以连,python 那边也写了 password,但还是报错,using password no
|
3
vipppppp 2018-04-27 09:05:17 +08:00
你不贴代码,怎么看。。
|
4
HanYang1 OP @vipppppp 就这里 connection = pymysql.connect(host='localhost',
user='root', db='wocao', password='xxxxxx') 密码是对的,但报错 |
5
HanYang1 OP ok 啦,不知道为什么用 mysql-connector-python 就 ok 啦
|