最后解决方案,参考:
https://blog.csdn.net/wangzhepaohui/article/details/109685612
谢谢陆神
坑 1:
mysql 8.0 如果在my.ini 中加入skip-grant-tables, 服务是无法启动成功的。在 win + R 里面运行services.msc,可以看到mysql 启动后,再刷新还是start。
解决方案: my.ini 中删除skip-grant-tables
my.ini 参考:
'''
[mysql]
default-character-set=utf8
[mysqld]
default-storage-engine=INNODB
basedir=C:/Program Files/mysql-8.0.25-winx64
datadir=C:/Program Files/mysql-8.0.25-winx64/data
'''
坑 2:
mysqld --console --skip-grant-tables --shared-memory 不好用
各种命令都用的,最后还是陆神的好使
解决方案:
- 删了data, my.ini 搞个我上面那个
- win + R 里面运行services.msc
stop mysql
- sc delete mysql
-
mysqld --initialize-insecure --user=mysql
mysqld --install "mysql" --defaults-file="C:\Program Files\mysql-8.0.25-winx64\my.ini"
- net start mysql
7.mysql -u root -p
- 该密码:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
各种错误日志:
C:\Program Files\mysql-8.0.25-winx64\bin>mysqld --console --skip-grant-tables --shared-memory
2021-05-28T10:31:32.451384Z 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-05-28T10:31:32.451612Z 0 [System] [MY-010116] [Server] C:\Program Files\mysql-8.0.25-winx64\bin\mysqld.exe (mysqld 8.0.25) starting as process 6928
2021-05-28T10:31:32.466641Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-05-28T10:31:32.964058Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-05-28T10:31:33.212757Z 0 [Warning] [MY-011311] [Server] Plugin mysqlx reported: 'All I/O interfaces are disabled, X Protocol won't be accessible'
2021-05-28T10:31:33.248063Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
2021-05-28T10:31:33.254689Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
2021-05-28T10:31:33.298284Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-05-28T10:31:33.298685Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-05-28T10:31:33.324011Z 0 [System] [MY-010931] [Server] C:\Program Files\mysql-8.0.25-winx64\bin\mysqld.exe: ready for connections. Version: '8.0.25' socket: '' port: 0 MySQL Community Server - GPL.
2021-05-28T11:06:03.276955Z 0 [System] [MY-013105] [Server] C:\Program Files\mysql-8.0.25-winx64\bin\mysqld.exe: Normal shutdown.
Thread pointer: 0x1c5f286a6a0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
7ff74ffeb242 mysqld.exe!my_sigabrt_handler()[my_thr_init.cc:372]
7ffee836dc17 ucrtbase.dll!raise()
7ffee836eaa1 ucrtbase.dll!abort()
7ff7502360b7 mysqld.exe!ut_dbg_assertion_failed()[ut0dbg.cc:90]
7ff750177e0c mysqld.exe!dict_table_add_to_cache()[dict0dict.cc:1235]
7ff75028d02e mysqld.exe!dd_open_table_onedd::Table()[dict0dd.cc:4062]
7ff75028bad6 mysqld.exe!dd_open_tabledd::Table()[dict0dd.cc:4229]
7ff75013a5d0 mysqld.exe!ha_innobase::open()[ha_innodb.cc:6150]
7ff74f28a1ea mysqld.exe!handler::ha_open()[handler.cc:2633]
7ff74f31c7b8 mysqld.exe!open_table_from_share()[table.cc:2941]
7ff74f42495e mysqld.exe!open_table()[sql_base.cc:3298]
7ff74f423920 mysqld.exe!open_and_process_table()[sql_base.cc:4958]
7ff74f425886 mysqld.exe!open_tables()[sql_base.cc:5583]
7ff74f425dd1 mysqld.exe!open_tables_for_query()[sql_base.cc:6363]
7ff74f4d0ec9 mysqld.exe!Sql_cmd_dml::prepare()[sql_select.cc:345]
7ff74f4cd88d mysqld.exe!Sql_cmd_dml::execute()[sql_select.cc:494]
7ff74f432d38 mysqld.exe!mysql_execute_command()[sql_parse.cc:4147]
7ff74f433816 mysqld.exe!mysql_parse()[sql_parse.cc:4927]
7ff74f42d6b8 mysqld.exe!dispatch_command()[sql_parse.cc:1607]
7ff74f42e5e5 mysqld.exe!do_command()[sql_parse.cc:1233]
7ff74f2ac538 mysqld.exe!handle_connection()[connection_handler_per_thread.cc:308]
7ff7503d3e87 mysqld.exe!pfs_spawn_thread()[pfs.cc:2839]
7ff74ffeb1dc mysqld.exe!win_thread_start()[my_thread.cc:52]
7ffee831cd70 ucrtbase.dll!_o__realloc_base()
7ffeeb708364 KERNEL32.DLL!BaseThreadInitThunk()
7ffeeb9c70b1 ntdll.dll!RtlUserThreadStart()