0,删data文件
1,mysqld --initialize --console
初始化mysql
2,net start mysql
启动
3,mysql -uroot -p
4,输入刚刚的随机密码
5,ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘123456’;
改密码
services.msc打开服务,看是不是没启动
D:\mysql-8.0.26-winx64\mysql-8.0.26-winx64\bin>mysqld --console
2023-02-21T12:50:32.484621Z 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.
2023-02-21T12:50:32.485609Z 0 [System] [MY-010116] [Server] D:\mysql-8.0.26-winx64\mysql-8.0.26-winx64\bin\mysqld.exe (mysqld 8.0.26) starting as process 5224
2023-02-21T12:50:32.489898Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2023-02-21T12:50:32.529810Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-02-21T12:50:32.536974Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2023-02-21T12:50:32.537359Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2023-02-21T12:50:32.558315Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2023-02-21T12:50:32.559801Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2023-02-21T12:50:32.560960Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-02-21T12:50:32.570331Z 0 [System] [MY-010910] [Server] D:\mysql-8.0.26-winx64\mysql-8.0.26-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.26) MySQL Community Server - GPL.
D:\mysql-8.0.26-winx64\mysql-8.0.26-winx64\bin>mysql -u root -p
Enter password: ******
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost:3306' (10061)
D:\mysql-8.0.26-winx64\mysql-8.0.26-winx64\bin>mysql -u root -p
Enter password: ******
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
D:\mysql-8.0.26-winx64\mysql-8.0.26-winx64\bin>mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
D:\mysql-8.0.26-winx64\mysql-8.0.26-winx64\bin>mysql -u root -p 111111
Enter password: ******
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)




5万+

被折叠的 条评论
为什么被折叠?



