【发布时间】:2020-10-10 18:51:20
【问题描述】:
我最近将我的 vagrant 版本更新为 2.2.9。运行命令时,vagrant up 我现在收到此错误:
homestead: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
homestead: Job for mariadb.service failed because the control process exited with error code.
homestead: See "systemctl status mariadb.service" and "journalctl -xe" for details.
我不确定是什么导致了这个问题,我过去已经多次更新了 virtualbox、vagrant 和 homestead 包,没有问题。
我的机器是 OS Catalina 10.15.5
我已经尝试卸载并重新安装,我还尝试安装旧版本的 vagrant。一切都会导致上述相同的错误。我不确定下一步该做什么 - 非常感谢任何建议!
编辑 谢谢你,@Aminul! 这是我得到的输出:
Status: "MariaDB server is down"
Jun 20 19:17:53 homestead mysqld[42962]: 2020-06-20 19:17:53 0 [Note] InnoDB: Starting shutdown...
Jun 20 19:17:54 homestead mysqld[42962]: 2020-06-20 19:17:54 0 [ERROR] Plugin 'InnoDB' init function returned error.
Jun 20 19:17:54 homestead mysqld[42962]: 2020-06-20 19:17:54 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
Jun 20 19:17:54 homestead mysqld[42962]: 2020-06-20 19:17:54 0 [Note] Plugin 'FEEDBACK' is disabled.
Jun 20 19:17:54 homestead mysqld[42962]: 2020-06-20 19:17:54 0 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
Jun 20 19:17:54 homestead mysqld[42962]: 2020-06-20 19:17:54 0 [ERROR] Unknown/unsupported storage engine: InnoDB
Jun 20 19:17:54 homestead mysqld[42962]: 2020-06-20 19:17:54 0 [ERROR] Aborting
Jun 20 19:17:54 homestead systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jun 20 19:17:54 homestead systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jun 20 19:17:54 homestead systemd[1]: Failed to start MariaDB 10.4.13 database server.
运行:mysql --version 返回:
mysql Ver 15.1 Distrib 10.4.13-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
很明显,这意味着 MariaDB 没有启动。我可以研究如何开始。不过我更好奇——这是宅基地发生的事情吗?或者这是其他原因的结果?通常,我可以vagrant up,一切都很好。我担心如果我把事情搞砸了,我会为自己的失败做好准备。
编辑 2
运行时:
vagrant@homestead:~$ systemctl start mysqld.service
这是我收到的提示:
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'mariadb.service'.
Authenticating as: vagrant,,, (vagrant)
Password:
我不确定继续测试的凭据是什么。
其他解决方案
谢谢你,Raphy963! 我不想回答自己的问题,但我找到了另一种解决方法,希望能对其他人有所帮助。
我正在开发的应用程序尚未投入生产,因此我能够将我的数据库从 MySQL 更改为 PostgreSQL。
我删除/卸载了 virtualbox、vagrant 和 homestead 的所有实例。我还删除了“VirtualBox VMs”目录。
我重新安装了所有东西,从 VirtualBox、Vagrant 开始,然后是 laravel/homestead。我现在正在运行所有内容的最新版本;使用Laravel documentation 获取说明。
安装完所有东西后,运行vagrant up 并没有产生错误,但是我仍然无法连接到 MySQL。
我将Homestead.yaml 文件更新为以下内容:
---
ip: "10.10.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: /Users/<username>/Sites
to: /home/vagrant/sites
sites:
- map: blog.test
to: /home/vagrant/sites/blog/public
databases:
- blog
- homestead
features:
- mariadb: false
- ohmyzsh: false
- webdriver: false
我将我的主机文件更新为:
10.10.10.10 blog.test
最后,使用TablePlus 我能够连接到以下内容:
我的 Laravel 应用程序中的 .env 文件如下所示:
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=blog
DB_USERNAME=homestead
DB_PASSWORD=secret
我现在可以使用 TablePlus 和我的应用程序进行连接。
希望这对某人有所帮助!
【问题讨论】: