skip to Main Content

I have recently updated my vagrant version to 2.2.9. When running the command, vagrant up I am now getting this error:

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.

I’m not sure what is causing this issue, I’ve updated the virtualbox, vagrant and the homestead package many times in the past without issue.

My machine is OS Catalina 10.15.5

I have tried uninstalling & re-installing, I’ve also tried installing an older version of vagrant. Everything results in the same error above. I’m not sure what to do next – any suggestions are greatly appreciated!

EDIT
Thank you, @Aminul!
Here is the output I get:

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.

Running: mysql --version returns:

mysql  Ver 15.1 Distrib 10.4.13-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

So clearly, it’s saying that MariaDB is not started. I can research how to start that. I’m more curious though — is this something that’s happened to homestead? Or is this a result of something else? Normally, I can just vagrant up and everything is good to go. I worry that if I mess with things I’m setting myself up for failure down the road.

EDIT 2

When running this:

vagrant@homestead:~$ systemctl start mysqld.service

This is what I am prompted with:

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'mariadb.service'.
Authenticating as: vagrant,,, (vagrant)
Password: 

I’m not sure what the credentials are to keep testing.

ADDITIONAL SOLUTION

Thank you,Raphy963!
I didn’t want to answer my own question, and I was able to find another work-around that hopefully will help someone else.

The application I am working on is not yet in production, so I was able to change my database from MySQL to PostgreSQL.

I removed/uninstalled all instances of virtualbox, vagrant & homestead. I also removed the "VirtualBox VMs" directory.

I re-installed everything, starting with VirtualBox, Vagrant & then laravel/homestead. I am now running the latest versions of everything; using the Laravel documentation for instructions.

After everything was installed, running vagrant up did not create errors, however I was still not able to connect to MySQL.

I updated my Homestead.yaml file to the following:

---
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

I updated my hosts file to this:

10.10.10.10     blog.test

Finally, using TablePlus I was able to connect with the following:
enter image description here

My .env file in my Laravel application looks like this:

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=blog
DB_USERNAME=homestead
DB_PASSWORD=secret

I am now able to connect using TablePlus and from my application.

Hope this helps someone!!

2

Answers


  1. You will need to investigate what is the cause.

    Login to your instance by runing vagrant ssh and run systemctl status mariadb.service for checking the error log.

    Check what is is the error and reply here if you didn’t understand.

    Login or Signup to reply.
  2. I was having the same issue and spent way too much time trying to fix it. I tried using the new release of Homestead from their GitHub repo (https://github.com/laravel/homestead) which claims to fix this exact issue but it didn’t work.

    After investigating on my own, I realized the scripts used in Vagrant for homestead to work (This repo over here https://github.com/laravel/settler) has been updated to "10.0.0-beta". I did the following to put it back to "9.5.1".

    vagrant box remove laravel/homestead
    vagrant box add laravel/homestead --box-version 9.5.1
    

    Afterwards, I remade my instance by using vagrant destroy and vagrant up and MariaDB was up and running once more.

    While this might not be the best solution, at least I got it to work which is good enough for me.

    Hope it helped!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search