Posted in Wordpress Dev

Vagrant/VVV: Upgrading Mysql to 5.6


WordPress requirements state:

To run WordPress we recommend your host supports:

  • PHP version 5.6 or greater
  • MySQL version 5.6 or greater OR MariaDB version 10.0 or greater

If you’re using Vagrant and VVV as your WordPress development workflow, here’s how I upgraded mysql from 5.5 to version to 5.6. If you want more info about how to use and setup this workflow checkout these tutorials.

I came across lots of articles and discussions about upgrading mysql when using a Vagrant/VVV setup, but my main question was “do I upgrade from within the virtual box or from my computer?”  None of the articles I found answered that question. So in case it’s not obvious to you either–here’s how you do it. I’m outlining these steps as if you’re also on a Mac:

Install 5.6 in the Virtual Box:

  1. From a Terminal window, change directory (cd) to your vvv folder:
    cd ~/vvv
  2. SSH into the virtual server:
    vagrant ssh
  3. Now issue the commands from this script (copy and paste the commands into the prompt and press enter):
    # Backup of all databases... JUST IN CASE
    mysqldump --all-databases --single-transaction --events --user=root --password > ~/all_database_backup.sql

    # Remove MySQL 5.5
    sudo apt-get remove mysql-server
    sudo apt-get autoremove

    # Install MySQL 5.6
    sudo apt-get install mysql-client-5.6 mysql-client-core-5.6
    sudo apt-get install mysql-server-5.6
  4. Check to see which version of Mysql is now installed:
    mysql -V
  5. You should see that you have version 5.6. Wee!
  6. Keep your ssh connection open if needed, or you can now exit


Update Your File from Your Mac:

  1. From a new Terminal window, change directory to your vvv folder
    cd ~/vvv
    – or if you exited your ssh connection, you should already be there. Print working directory to check your path pwd
  2. List the contents of the vvv directory ls
  3. Change directory to provision
    cd provision
  4. Edit the script file you find inside:
  5. Use your arrow keys to move down to the line that says mysql-server
  6. Press i to get into — INSERT — mode
    1. Use your arrow keys to get to the end of mysql-server
    2. and type -5.6 so it now says mysql-server-5.6
    3. Press the esc key to get out of — INSERT — mode.
    4. Type :wq to get into the vim command mode (:) and to write (save) the file and quit vim
  7. Now you need to run the provision script: vagrant provision or if vagrant isn’t running vagrant up --provision
  8. In the verbose log that’s printed to your Terminal window you should see

    ==> default:  * mysql-server-5.6


That should do the trick!

And here’s a beginner’s guide to bash scripting that I found handy, and where I learned that chmod stands for change mode. 😀

p.s. I’m using Local by Flywheel these days instead of VVV for WordPress local dev. It’s nice to have a GUI and it’s speedy to create a new site! And since it uses Docker, you can enable live links to share your local progress with clients and teammates. Pretty cool. =^..^=


Art Director, Web & Graphic Designer =^..^=

6 thoughts on “Vagrant/VVV: Upgrading Mysql to 5.6

    1. Hi amancingh,

      Looks like the latest version of VVV’s file has MariaDB as the default database. When I first installed VVV – MySQL was listed as the default. This was a fairly recent change.

      I’ve been reading about the differences between MySQL and MariaDB because I didn’t really know – and essentially MariaDB is an open source version of MySQL. You should be able to use MariaDB instead of MySQL 5.6.

      I’m not sure how to switch from MariaDB to MySQL using the file. A lot of this is still over my head. There’s this feature that someone requested for a future VVV release to help switch between databases for testing:

      Let me know if you figure out how to switch from MariaDB back to MySQL 5.6, or if you’re going to just use MariaDB! I’m curious now. ~ CB

      Liked by 2 people

      1. Hi i was able to get it to work, just ssh to your vagrant (below are the steps) it was a new box i spined up so you might need to backup your db before you do that, it works perfectly for me now when i do vagrant up (do a vagrant provision as well once u update the sql) i am not sure if thats the sure shot way but it works for me and i can have my wordpress setup, i didnt had to update anything in file.
        vagrant ssh
        sudo apt-get install mysql-client-5.6 mysql-client-core-5.6
        sudo apt-get install mysql-server-5.6


        Liked by 2 people

      2. Hi Robin,

        Thanks for coming back to let me know how you got back to your preferred MySQL setup! Hope this helps others who stumble across this post. 🙂 Happy dev-ing!

        Liked by 2 people

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.