推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
HanYang1
V2EX  ›  Python

python3 PyMySQL 连接 MySQL 数据库问题, win10,如下

  •  
  •   HanYang1 · Apr 27, 2018 · 4164 views
    This topic created in 3084 days ago, the information mentioned may be changed or developed.

    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>

    5 replies  •  2018-04-27 13:39:00 +08:00
    3IOhG7M0knRu5UlC
        1
    3IOhG7M0knRu5UlC  
       Apr 27, 2018 via Android
    Use password no ?
    HanYang1
        2
    HanYang1  
    OP
       Apr 27, 2018
    @GooMS 使得,我 cmd 上可以连,python 那边也写了 password,但还是报错,using password no
    vipppppp
        3
    vipppppp  
       Apr 27, 2018
    你不贴代码,怎么看。。
    HanYang1
        4
    HanYang1  
    OP
       Apr 27, 2018
    @vipppppp 就这里 connection = pymysql.connect(host='localhost',
    user='root',
    db='wocao',
    password='xxxxxx')
    密码是对的,但报错
    HanYang1
        5
    HanYang1  
    OP
       Apr 27, 2018
    ok 啦,不知道为什么用 mysql-connector-python 就 ok 啦
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2465 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 06:53 · PVG 14:53 · LAX 23:53 · JFK 02:53
    ♥ Do have faith in what you're doing.