最近,我的 Homebrew MySQL 设置在尝试启动时开始失败。当我运行 时mysql.server start
,出现以下错误:
$ mysql.server start
Starting MySQL
.. ERROR! The server quit without updating PID file (/opt/homebrew/var/mysql/MacBookPro.pid).
以下是来自的日志/opt/homebrew/var/mysql/${computer_name}.err
:
2025-01-01T22:08:13.6NZ mysqld_safe Logging to '/opt/homebrew/var/mysql/MacBookPro.err'.
2025-01-01T22:08:13.6NZ mysqld_safe Starting mysqld daemon with databases from /opt/homebrew/var/mysql
2025-01-01T22:08:13.378645Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2025-01-01T22:08:13.521513Z 0 [System] [MY-010116] [Server] /opt/homebrew/opt/mysql/bin/mysqld (mysqld 9.0.1) starting as process 40612
2025-01-01T22:08:13.522727Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /opt/homebrew/var/mysql/ is case insensitive
2025-01-01T22:08:13.536732Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-01-01T22:08:13.583485Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-01-01T22:08:13.716166Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2025-01-01T22:08:13.716195Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2025-01-01T22:08:13.719572Z 0 [ERROR] [MY-000067] [Server] unknown variable 'default_authentication_plugin=mysql_native_password'.
2025-01-01T22:08:13.720023Z 0 [ERROR] [MY-010119] [Server] Aborting
2025-01-01T22:08:14.884732Z 0 [System] [MY-010910] [Server] /opt/homebrew/opt/mysql/bin/mysqld: Shutdown complete (mysqld 9.0.1) Homebrew.
2025-01-01T22:08:14.884778Z 0 [System] [MY-015016] [Server] MySQL Server - end.
2025-01-01T22:08:14.6NZ mysqld_safe mysqld from pid file /opt/homebrew/var/mysql/MacBookPro.pid ended
有趣的是下面这一行,这似乎就是问题所在:
2025-01-01T22:08:13.719572Z 0 [ERROR] [MY-000067] [Server] unknown variable 'default_authentication_plugin=mysql_native_password'.
这里是my.cnf
:
# Default Homebrew MySQL server config
[mysqld]
default_authentication_plugin= mysql_native_password
# Only allow connections from localhost
bind-address = 127.0.0.1
mysqlx-bind-address = 127.0.0.1
另一个数据点是,如果我运行mysql.server stop
,我会收到此错误:
$ mysql.server stop
ERROR! MySQL server PID file could not be found!
这是我的 MySQL 版本:
$ mysql --version
mysql Ver 9.0.1 for macos15.1 on arm64 (Homebrew)
我在 M1 MacBook Pro 上运行 macOS Sequoia 15.2。
有很多类似的帖子,但似乎都没什么帮助。如果可能的话,我也不想删除我的数据库,而是重新开始。
有人知道是什么原因造成的,以及如何解决它吗?这可能是因为 MySQL 9 不支持吗default_authentication_plugin=mysql_native_password
?