首頁>Database>source
遷移的,因為它可以 在資料庫管理員堆棧交換中得到解答。 已遷移昨天
最新回復
  • 5月前
    1 #

    因為未顯示任何錯誤(但是2021-01-01T09:15:45.594 ^ C297看起来不正常!),您應该按照该過程中的步骤进行下一步。

    請檢查您的密碼是否更改。

    如果您的密碼未更改,請建立一个簡單的初始化檔案(即与第3步中建議的相同),然後重試。

    如果您更改了密碼,請不要忘記删除 init-file

    編輯

    :我按照该步骤重置了" root"密碼。

    此会话的所有輸出都在這裏,中間有一些NOTE:

    首先,我们註意到我们不知道密碼:

    C:\Program Files\MySQL\MySQL Server 8.0>mysql -u root -p
    Enter password: *******
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
    C:\Program Files\MySQL\MySQL Server 8.0>
    

    然後建立一个mysql-init.txt檔案:

    C:\Program Files\MySQL\MySQL Server 8.0>type mysql-init.txt
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
    

    然後,我们停止MySQL服務器.我的服務器名為MySQL80,但是您也可以在"服務"視窗中將其停止(更多详细資訊在這裏)

    C:\Program Files\MySQL\MySQL Server 8.0>net stop MySQL80
    The MySQL80 service is stopping.
    The MySQL80 service was stopped successfully.
    

    使用以下密碼重置密碼:

      Note the double \\ in the path names, and the " surrounding the complete path

      My default settings for MySQL are located here "D:\MySQL Server 8.0\my.ini", this is almost sure different at your location

       C:\Program Files\MySQL\MySQL Server 8.0>bin\mysqld.exe --defaults-file="D:\\MySQL Server 8.0\\my.ini" --init-file="C:\\Program Files\\MySQL\\MySQL Server 8.0\\mysql-init.txt" --console
        2021-01-01T18:51:09.333120Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
        2021-01-01T18:51:09.333840Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.22) starting as process 21888
        2021-01-01T18:51:09.341869Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
        2021-01-01T18:51:09.908748Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
        2021-01-01T18:51:10.083573Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060
        2021-01-01T18:51:10.143779Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
        2021-01-01T18:51:10.144078Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
        2021-01-01T18:51:10.192745Z 0 [System] [MY-010931] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: ready for connections. Version: '8.0.22'  socket: ''  port: 3306  MySQL Community Server - GPL.
    

    現在服務器開始輸出,並輸出到控製台,要停止服務器,請輸入CTRL + C:

    2021-01-01T18:51:20.697066Z 0 [System] [MY-013105] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Normal shutdown.
    ^C
    C:\Program Files\MySQL\MySQL Server 8.0>2021-01-01T18:51:21.447960Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.22)  MySQL Community Server - GPL.
    

    我们以正常方式(或通過服務)重新啟動服務器:

    C:\Program Files\MySQL\MySQL Server 8.0>net start mysql80
    The MySQL80 service is starting.
    The MySQL80 service was started successfully.
    

    我们尝試登錄:

    C:\Program Files\MySQL\MySQL Server 8.0>mysql -u root -pMyNewPass
    mysql: [Warning] Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 8
    Server version: 8.0.22 MySQL Community Server - GPL
    Copyright (c) 2000, 2020, 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> alter user 'root'@'localhost' IDENTIFIED BY 'stackoverflow';
    

    使用最後一條命令,密碼可以更改為" stackoverflow".我敢肯定,讀過此书的人都会想到更好的密碼。

  • 5月前
    2 #

    另一種替代解決方案是使用windirstat从程式資料和程式檔案中删除mysql。

  • sql server:如何通過檔案識別消耗最大磁盤空間的表?
  • postgresql:Postgres 11:升級後查詢計划使用seq掃描