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...
  • 相关阅读:
    led呼吸灯
    定时器中断
    npgsql
    中断
    PAT (Advanced Level) 1128~1131:1128N皇后 1129 模拟推荐系统(set<Node>优化) 1130 中缀表达式
    PAT (Advanced Level) 1132~1135:1132 模拟 1133模拟(易超时!) 1134图 1135红黑树
    PAT (Advanced Level) 1136~1139:1136模拟 1137模拟 1138 前序中序求后序 1139模拟
    PAT (Advanced Level) 1140~1143:1140模拟 1141模拟 1142暴力 1143 BST+LCA
    PAT (Advanced Level) 1144~1147:1145Hash二次探查 1146拓扑排序 1147堆
    python实现http接口测试
  • 原文地址:https://www.cnblogs.com/watermarks/p/13032525.html
Copyright © 2011-2022 走看看