【轉載須知】轉載請標注本文鏈接地址。
安裝包: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
【解決方案】
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 Files\MySQL\MySQL Server 8.0\bin\mysql.exe --defaults-extra-file="C:\Users\Administrator\AppData\Local\Temp\339b0e62-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 Files\MySQL\MySQL Server 8.0\bin\mysqladmin.exe --defaults-extra-file="C:\Users\Administrator\AppData\Local\Temp\339b0e62-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:\Users\Administrator\AppData\Local\Temp\77f675c3-f387-4b4a-9c92-354bb12093ae.ini ,發現沒找到。
通過服務找到mysql服務對一個文件“my.ini”
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.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
發現沒有用。。還是報原來的錯誤。
最后只能重新安裝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...