“cryptography is required for sha256_password or caching_sha2_password”

后端 未结 7 1718
挽巷
挽巷 2020-12-13 19:29

Good day. Hope your all are well. Can someone help me with fix this?

I\'m new to the MySQL environment. I\'m trying to connect to MySQL Database remotely. I used th

相关标签:
7条回答
  • 2020-12-13 19:37

    For what it's worth, I had this problem today using MySQL via SQLAlchemy in Python. It turned out that I was using the wrong password for this account. In other words, if you have this problem, you might want to start by just confirming that you're using the correct password.

    FWIW, I am not sure why this generated a cryptography message. Something buggy along the way?

    0 讨论(0)
  • 2020-12-13 19:40

    The error message can be made more comprehensive and helpful. In order to fix this "cryptography" package needs to be installed.

    pip install cryptography
    
    0 讨论(0)
  • 2020-12-13 19:41

    To use “sha256_password” or “caching_sha2_password” for authenticate, you need to install additional dependency:

    $ python3 -m pip install PyMySQL[rsa]
    

    Source: https://pymysql.readthedocs.io/en/latest/user/installation.html

    0 讨论(0)
  • 2020-12-13 19:43

    Easy on MYSQL Workbench. Create a new MySQL user and fill the "Limit to Host Matching" with your IP. Is % by default.

    enter image description here

    0 讨论(0)
  • 2020-12-13 19:47

    I met this problem too. When I try to solve the problem use method of @brcmipn in MySQL Worbench, it tells me MySQL is running in Super Safe Mode.So I use

    SET GLOBAL READ_ONLY = OFF;
    

    and after that the problem don't happen again.

    0 讨论(0)
  • 2020-12-13 19:59
    import mysql.connector
    def connection():
        conn = mysql.connector.connect(host = "XXXXX",
                      user = 'XXXXX',
                      password = 'XXXXX',
                      database = 'login_page',
                      auth_plugin='mysql_native_password')
    
        c = conn.cursor()
        return c , conn
    

    Download mysql connector rather than pymysql and try connecting this way. It worked for me, hope it works for u too.

    0 讨论(0)
提交回复
热议问题