zoukankan      html  css  js  c++  java
  • 【已解决】MYSQL安装过程报错,怎么解决?MySQL error 0: Authentication to host 'localhost' for user 'root' using method 'caching_sha2_password' failed with message: Reading from the stream has failed.

    【转载须知】转载请标注本文链接地址。

    安装包:mysql-installer-community-8.0.20.0.msi

    MySQL安装版本:8.0.20

    环境:WIN 7 -64位

    安装MySQL server时,Creating uer accounts时报错:

    Attempting to start service MySQL80...
    Successfully started service MySQL80.
    Waiting until a connection to MySQL Server 8.0.20 can be established (with a maximum of 10 attempts)...
    Retry 1: Attempting to connect to Mysql@localhost:3306 with user root with a password...
    MySQL error 0: Authentication to host 'localhost' for user 'root' using method 'caching_sha2_password' failed with message: Reading from the stream has failed.
    Waiting 5 seconds before the next connection attempt...
    Retry 2: Attempting to connect to Mysql@localhost:3306 with user root with a password...
    MySQL error 0: Authentication to host 'localhost' for user 'root' using method 'caching_sha2_password' failed with message: Reading from the stream has failed.
    Waiting 5 seconds before the next connection attempt...
    Retry 3: Attempting to connect to Mysql@localhost:3306 with user root with a password...

    Beginning configuration step: Creating user accounts

    Attempting to Add New MySQL Users
    An error occurred trying to add new users to the MySQL database (see log).
    Ended configuration step: Creating user accounts

    【解决方案】

    ref:https://community.progress.com/s/article/Authentication-to-host-localhost-for-user-root-using-method-mysql-native-password-failed-with-message-Reading-from-the-stream-has-failed

    Solution
    Authentication to host 'localhost' for user 'root' using method 'mysql_native_password' failed with message: Reading from the stream has failed.
    
    while database update, the following solution for the Problem:
    
    1. Press Win+R to open the "Run" dialog
    2. Type "gpedit.msc" (without quotes) and press Enter
    3. In the "Local Group Policy Editor", expand "Computer Configuration", expand "Administrative Templates", expand "System", expand "Internet Communication Management", and then click "Internet Communication settings".
    4. In the details panel, double-click "Turn off Automatic Root Certificates Update", clickEnabled, then click OK. This change will be effective immediatelly without restart.
    After that, the repair task for the aborted Update went through.

    截图:cmd 运行 gpedit.msc

    找到【管理模板】-Internet通信设置】, 

    右键【关闭自动根证书更新】-点击【编辑】-改为【已启用】

      

     再次运行安装程序:

     server安装成功!

     记得把sampling and examples也reconfigure/安装下,因为需要输入root密码。

    ------------调试记录,以下请忽略---------

     log:

    Beginning configuration step: Stopping the server
    
    Setting innodb_fast_shutdown to do a clean shutdown (a full purge and a change buffer merge before shutting down).
    Starting process with command: C:Program FilesMySQLMySQL Server 8.0inmysql.exe --defaults-extra-file="C:UsersAdministratorAppDataLocalTemp339b0e62-6fab-408f-b2b9-9dd938b44fc4.ini" --user=root --default-auth=caching_sha2_password --host=localhost --port=3306 -e"SET GLOBAL innodb_fast_shutdown = 0"...
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
    Process for mysql, with ID 60436, was run successfully and exited with code 1.
    There was an error trying to set innodb_fast_shutdown to do a clean shutdown.
    Executing mysqladmin shutdown to do a clean shutdown.
    Starting process with command: C:Program FilesMySQLMySQL Server 8.0inmysqladmin.exe --defaults-extra-file="C:UsersAdministratorAppDataLocalTemp339b0e62-6fab-408f-b2b9-9dd938b44fc4.ini" --user=root --default-auth=caching_sha2_password --host=localhost --port=3306 shutdown...
    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost' (using password: YES)'
    Process for mysqladmin, with ID 31212, was run successfully and exited with code 1.
    There was an error trying to perform a clean shutdown.
    Stopping MySQL Server instance...
    Found Windows service for the server instance. Stopping MySQL service...
    MySQL service stopped successfully...
    Ended configuration step: Stopping the server
    
    Beginning configuration step: Writing configuration file

    上面标黄的路径,找该文件:C:UsersAdministratorAppDataLocalTemp77f675c3-f387-4b4a-9c92-354bb12093ae.ini ,发现没找到。

    通过服务找到mysql服务对一个文件“my.ini”

    "C:Program FilesMySQLMySQL Server 8.0inmysqld.exe" --defaults-file="C:ProgramDataMySQLMySQL Server 8.0my.ini" MySQL80-2

    # Path to the database root
    datadir=C:/ProgramData/MySQL/MySQL Server 8.0/Data
    
    # The default character set that will be used when a new schema or table is
    # created and no character set is defined
    # character-set-server=
    
    # The default authentication plugin to be used when connecting to the server
    default_authentication_plugin=caching_sha2_password

    修改为:mysql_native_password

    发现没有用。。还是报原来的错误。

    ref:https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password

    最后只能重新安装server,然后选择 legacy模式,不要选择sha2模式。

    也同样报错:

    Retry 1: Attempting to connect to Mysql@localhost:3306 with user root with no password...
    MySQL error 0: Authentication to host 'localhost' for user 'root' using method 'mysql_native_password' failed with message: Reading from the stream has failed.
    Waiting 5 seconds before the next connection attempt...
  • 相关阅读:
    学习 iOS多线程开发 Demo示意
    python(数字Number)
    python(元组)
    python(列表)
    python(一)
    APP自动化测试框架搭建(转载)
    Appium真机运行Device Name获取方法
    关于android sdk manager在下载包时没有android intel x86 atom system image等项
    adb shell命令查看当前与用户交互的activity
    SDK更新
  • 原文地址:https://www.cnblogs.com/watermarks/p/13032525.html
Copyright © 2011-2022 走看看