mysql8.0パスワードフローをリセット-win 10
6896 ワード
mysql 8.0以上を参照してパスワードをリセットし、自分が出会った穴を追加します.
MYSQLパスワードをリセット0はすべて管理者として を実行します. binディレクトリ へ2 mysqlサービスを停止 2.1無効なサービス名 3 MySQLサービス開始時に権限表認証 をスキップ 3.1 Failed to set datadir to'C:Program FilesMySQLMySQL Server 8.0data'(OS errno:2-No such file or directory) 4新しいコマンドラインを開き、mysql を起動します.5 rootパスワード をクリア6 mysqlサービス を再起動7 mysql に入ります8パスワードの変更 9新しいパスワードを使用して にログイン THE END
0すべて管理者として実行
1進binディレクトリ
win 10 Cortanaはmysql shellを検索し、「ファイルの場所を開く」ことができます.
2 mysqlサービスの停止
2.1無効なサービス名
cmdにnet start mysqlヒントを入力:サービス名が無効またはMySQLが起動中MySQLが起動できません
先進binディレクトリ
コマンドラインに入力
成功:サービスsuccessfully installが表示されると、インストールに成功しました.
3 MySQLサービス開始時に権限表認証をスキップ
3.1 Failed to set datadir to‘C:Program FilesMySQLMySQL Server 8.0data’(OS errno:2-No such file or directory)
2020-06-27T10:35:55.418234Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.20) starting as process 7356 2020-06-27T10:35:55.421333Z 0 [Warning] [MY-010091] [Server] Can’t create test file C:\Program Files\MySQL\MySQL Server 8.0\data\mysqld_tmp_file_case_insensitive_test.lower-test 2020-06-27T10:35:55.421408Z 0 [Warning] [MY-010091] [Server] Can’t create test file C:\Program Files\MySQL\MySQL Server 8.0\data\mysqld_tmp_file_case_insensitive_test.lower-test 2020-06-27T10:35:55.421583Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to ‘C:\Program Files\MySQL\MySQL Server 8.0\data’ (OS errno: 2 - No such file or directory) 2020-06-27T10:35:55.455606Z 0 [ERROR] [MY-010119] [Server] Aborting 2020-06-27T10:35:55.455799Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.20) MySQL Community Server - GPL.
参考資料
解決[ERROR][MY-01276][Server]Failed to set datadir to‘F:Mysqlmysql-8.0.19-winx 64data’(OS er
2020-06-27T11:12:41.246262Z 0 [System] [MY-013169] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.20) initializing of server in progress as process 13880 2020-06-27T11:12:41.263871Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2020-06-27T11:12:42.438142Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2020-06-27T11:12:44.227965Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: sXrsP9:qx3SR
The service already exists! The current server installed: “C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld” MySQL
[SC]DeleteService成功
Service successfully installed.
MySQLサービスが起動しています.MySQLサービスが正常に開始されました.
MySQLサービスが停止しています.MySQLサービスが正常に停止しました.
2020-06-27T11:17:46.374142Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.20) starting as process 3976 2020-06-27T11:17:46.390118Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2020-06-27T11:17:47.007918Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2020-06-27T11:17:47.278043Z 0 [Warning] [MY-011311] [Server] Plugin mysqlx reported: ‘All I/O interfaces are disabled, X Protocol won’t be accessible’ 2020-06-27T11:17:47.441694Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2020-06-27T11:17:47.494282Z 0 [System] [MY-010931] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: ready for connections. Version: ‘8.0.20’ socket: ‘’ port: 0 MySQL Community Server - GPL.
これで起動したので、このコマンドを動かさないでください.
4コマンドラインを新しく開きmysqlを起動
binに入ってmysqlを開けて
Welcome to the MySQL monitor. Commands end with ; or\g. Your MySQL connection id is 7 Server version: 8.0.20 MySQL Community Server - GPL
Copyright © 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>
5 rootパスワードをクリア
Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0
Bye
6 mysqlサービスの再起動
以前のコマンドラインで開いていたmysqlサービスを停止しました
(Ctrl+Cマルチポイント数回)
そして実行
7 mysqlへ
入力
パスワードを入力する必要がなくenterキーを直接押します(ここでパスワードは空になっています)
Enter password: Welcome to the MySQL monitor. Commands end with ; or\g. Your MySQL connection id is 9 Server version: 8.0.20
Copyright © 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>
8パスワードの変更
Query OK, 0 rows affected (0.01 sec)
Bye
9新しいパスワードでログイン
新しいパスワードを入力してください
THE END
MYSQLパスワードをリセット
0すべて管理者として実行
1進binディレクトリ
win 10 Cortanaはmysql shellを検索し、「ファイルの場所を開く」ことができます.
cd C:\Program Files\MySQL\MySQL Server 8.0\bin
2 mysqlサービスの停止
net stop mysql
2.1無効なサービス名
cmdにnet start mysqlヒントを入力:サービス名が無効またはMySQLが起動中MySQLが起動できません
先進binディレクトリ
cd C:\Program Files\MySQL\MySQL Server 8.0\bin
コマンドラインに入力
mysqld --install
成功:サービスsuccessfully installが表示されると、インストールに成功しました.
3 MySQLサービス開始時に権限表認証をスキップ
mysqld --console --skip-grant-tables --shared-memory
3.1 Failed to set datadir to‘C:Program FilesMySQLMySQL Server 8.0data’(OS errno:2-No such file or directory)
2020-06-27T10:35:55.418234Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.20) starting as process 7356 2020-06-27T10:35:55.421333Z 0 [Warning] [MY-010091] [Server] Can’t create test file C:\Program Files\MySQL\MySQL Server 8.0\data\mysqld_tmp_file_case_insensitive_test.lower-test 2020-06-27T10:35:55.421408Z 0 [Warning] [MY-010091] [Server] Can’t create test file C:\Program Files\MySQL\MySQL Server 8.0\data\mysqld_tmp_file_case_insensitive_test.lower-test 2020-06-27T10:35:55.421583Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to ‘C:\Program Files\MySQL\MySQL Server 8.0\data’ (OS errno: 2 - No such file or directory) 2020-06-27T10:35:55.455606Z 0 [ERROR] [MY-010119] [Server] Aborting 2020-06-27T10:35:55.455799Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.20) MySQL Community Server - GPL.
参考資料
解決[ERROR][MY-01276][Server]Failed to set datadir to‘F:Mysqlmysql-8.0.19-winx 64data’(OS er
mysqld --initialize --user=mysql --console
2020-06-27T11:12:41.246262Z 0 [System] [MY-013169] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.20) initializing of server in progress as process 13880 2020-06-27T11:12:41.263871Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2020-06-27T11:12:42.438142Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2020-06-27T11:12:44.227965Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: sXrsP9:qx3SR
mysqld -install
The service already exists! The current server installed: “C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld” MySQL
sc delete mysql
[SC]DeleteService成功
mysqld -install
Service successfully installed.
net start mysql
MySQLサービスが起動しています.MySQLサービスが正常に開始されました.
net stop mysql
MySQLサービスが停止しています.MySQLサービスが正常に停止しました.
mysqld --console --skip-grant-tables --shared-memory
2020-06-27T11:17:46.374142Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.20) starting as process 3976 2020-06-27T11:17:46.390118Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2020-06-27T11:17:47.007918Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2020-06-27T11:17:47.278043Z 0 [Warning] [MY-011311] [Server] Plugin mysqlx reported: ‘All I/O interfaces are disabled, X Protocol won’t be accessible’ 2020-06-27T11:17:47.441694Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2020-06-27T11:17:47.494282Z 0 [System] [MY-010931] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: ready for connections. Version: ‘8.0.20’ socket: ‘’ port: 0 MySQL Community Server - GPL.
これで起動したので、このコマンドを動かさないでください.
4コマンドラインを新しく開きmysqlを起動
binに入ってmysqlを開けて
cd C:\Program Files\MySQL\MySQL Server 8.0\bin
mysql
Welcome to the MySQL monitor. Commands end with ; or\g. Your MySQL connection id is 7 Server version: 8.0.20 MySQL Community Server - GPL
Copyright © 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>
5 rootパスワードをクリア
use mysql;
update user set authentication_string = '' where user='root' ;
Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0
quit;
Bye
6 mysqlサービスの再起動
以前のコマンドラインで開いていたmysqlサービスを停止しました
(Ctrl+Cマルチポイント数回)
そして実行
net start mysql
7 mysqlへ
入力
mysql -uroot -p
パスワードを入力する必要がなくenterキーを直接押します(ここでパスワードは空になっています)
Enter password: Welcome to the MySQL monitor. Commands end with ; or\g. Your MySQL connection id is 9 Server version: 8.0.20
Copyright © 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>
8パスワードの変更
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
Query OK, 0 rows affected (0.01 sec)
quit;
Bye
9新しいパスワードでログイン
mysql -uroot -p
新しいパスワードを入力してください
THE END