Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

automica's avatar

downgrading mysql in laravel homestead

I'm using homestead for a php project (not laravel) which we need to run on mysql5.7

Whilst my dev version runs fine as its around a year old, the version I shared today with my colleague installed the latest homestead version that ships with mysql8.

Anyone experienced with homestead able to advise on how to downgrade the mysql version, or alternatively advise on latest version that we can use that gives at least php 7.3 but doesn't force us to use mysql8?

Thanks

0 likes
11 replies
automica's avatar

@jlrdw its a 6 year Drupal 7 site. Alas no mysql8 support as this version is EOL.

Due to Covid Drupal moved the sunsetting date to next year which meant our client batted off upgrading.

automica's avatar

I tried that and it didn't work.

I think I just needed to add

features:
  - mariadb: false
  - ohmyzsh: false
  - webdriver: false
  - mysql8: false
  - mysql: true

I also dropped back to v9.6.0 (from v10) which is currently passing my tests.

I will need to work out how to install only version 9.* rather than 10.* which seems to be versioned outside of my composer.json

I'll report back after my upgrade to v9.7.2 - currently taunting me (even though I'm on 200Mbps connection)

Progress: 1% (Rate: 70420/s, Estimated time remaining: 6:58:08)

MrBretts's avatar

Homestead v10 no longer includes MySQL 5.7; instead MySQL 8 is installed by default.

The feature script "mysql8" has been removed in Homestead version 10.0.0 as well.

The solution I found was to downgrade to Homestead 9 for any projects requiring MySQL 5.7. The alternative is to use Homestead 10 and manually install MySQL 5.7.

automica's avatar

@mrbretts aha, I removed homestead version 10 and it rebuilt the vagrant box using the 9.6 version I also had on my Mac.

I ran the following to remove v10

vagrant box remove laravel/homestead --box-version 10.0.0

Do you know what command Id run to install the latest 9.* which supports MySQL 5? That’s the last piece in the puzzle to get this working on my colleagues local dev environment

MrBretts's avatar

I found the easiest way for me to update was to open my homestead folder in terminal (cd ~/Homestead) and then run "vagrant box update". After the update is downloaded I like to run "vagrant box prune" to remove any older versions of Homestead.

To see what version of Homestead you have installed, run "vagrant box list" from within the Homestead folder.

// update the box
vagrant box update

// list all versions of box
vagrant box list

// remove old versions of a box
vagrant box prune
automica's avatar

I had 3 releases of version 9 and 1 of version 10 (that I’ve removed).

Wondering what command I would be able to do to get the most recent 9 version.

Is there a flag for vagrant box update to specify a particular version? My colleague will have version 10 and needs 9

MrBretts's avatar
MrBretts
Best Answer
Level 4

When you start the box, "vagrant box up", the terminal will tell you if you are using an outdated version. I don't like keeping old version of a box around so i like to run "vagrant box update" to download the latest copy of 9 (version 9.7.2 / (https://app.vagrantup.com/laravel/boxes/homestead) and then i run "vagrant box prune" to remove those any old versions from my machine.

To install/update a specific version of a box you can use the Vagrant box add option "--box-version VALUE". Here is an example.

 vagrant box add laravel/homestead --box-version 9.7.2

To learn more about that option and other commands i mentioned please checkout the Vagrant Box document here: https://www.vagrantup.com/docs/cli/box

As for your colleague i would run the command to remove version 10 and then use the box-version command above to install version 9.7.2 (https://app.vagrantup.com/laravel/boxes/homestead/versions/9.7.2). You could try just running vagrant box add laravel/homestead, but that may install version 10.

2 likes
automica's avatar

@mrbretts thanks. that's sorted our problem, and I learnt some stuff in the process.

Please or to participate in this conversation.