提问人:Aparichith 提问时间:9/14/2023 更新时间:9/14/2023 访问量:57
错误:无法通过套接字“/tmp/mysql.sock”连接到本地MySQL服务器(2)
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
问:
在通过 RVM 安装新的 ruby 版本时,我从 5.7 更新到 5.8。我的应用程序不支持 5.8,因此尝试将版本降级回 5.7。mysql
mysql
但没能成功。
# Stopped currently running mysql
brew services stop mysql
# uninstall mysql
brew uninstall mysql
# removed old config files
sudo rm -rf /opt/homebrew/var/mysql
# install required version
# brew install [email protected]
但我也可以看到一条警告消息post-install step did not complete successfully
2023-09-14T13:53:56.278342Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-09-14T13:53:56.281246Z 0 [Warning] Setting lower_case_table_names=2 because file system for /opt/homebrew/var/mysql/ is case insensitive
2023-09-14T13:53:56.351496Z 0 [Warning] InnoDB: New log files created, LSN=45790
2023-09-14T13:53:56.366220Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2023-09-14T13:53:56.423706Z 0 [ERROR] unknown variable 'mysqlx-bind-address=127.0.0.1'
2023-09-14T13:53:56.423724Z 0 [ERROR] Aborting
Warning: The post-install step did not complete successfully
You can try again using:
brew postinstall [email protected]
我尝试运行但返回了相同的错误brew postinstall [email protected]
==> Postinstalling [email protected]
==> /opt/homebrew/Cellar/[email protected]/5.7.43/bin/mysqld --initialize-insecure --user=mike --basedir=/opt/homebrew/Cellar/[email protected]/5.7.43 --datadir=/opt/homebrew/var/mysql --tmpdir=/tmp
Last 15 lines from /Users/mike/Library/Logs/Homebrew/[email protected]/post_install.01.mysqld:
2023-09-14 19:32:32 +0530
/opt/homebrew/Cellar/[email protected]/5.7.43/bin/mysqld
--initialize-insecure
--user=mike
--basedir=/opt/homebrew/Cellar/[email protected]/5.7.43
--datadir=/opt/homebrew/var/mysql
--tmpdir=/tmp
2023-09-14T14:02:32.051634Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-09-14T14:02:32.052340Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2023-09-14T14:02:32.052351Z 0 [ERROR] Aborting
Warning: The post-install step did not complete successfully
You can try again using:
brew postinstall [email protected]
但我可以看到安装了正确版本的 mysql
mysql -V
mysql Ver 14.14 Distrib 5.7.43, for osx10.17 (x86_64) using EditLine wrapper
我什至可以启动mysql服务
但是当我尝试这样做时,它不允许我为root用户设置密码。mysql_secure_installation
mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
我尝试了多种解决方案并重复了相同的流程。但仍然停留在同一个地方
答: 暂无答案
评论