Change Mysql version

Much light you might do with PHP, there is no way to change the Mysql versions quickly is there? I realized I have a bunch of local sites with old mysql versions. Looking for the fastest way to update mysql versions in Flywheel. Any suggestions? Thanks.

Hey @JP2017

There isn’t a quick way to update MySQL version.

For starters, you have to be on a custom site in order to update. The easiest way is probably exporting the existing site and then importing the exported zip file back into Local. Once you import the site, it will prompt you for the settings you want to use. Select “Custom” and then the MySQL version and a new Local site will be created with the updated environment.

– Ben

@ben.turner Thanks for the response. I don’t know why I have all these local installs with so old versions of mysql. Your solution maybe speed up the process a bit. Thanks.

Just chiming in to say it would be super useful to be able to amend the MySQL version much the same as we can amend the PHP version…

2 Likes

Hi,
Thank you for this solution that might have been helpful for others, but for me it isn’t. I am new to websites, but I have made a few before, but the current one I am working on is causing me issues…
I tried using this method, but when creating a new local website, (or when importing one) it automatically sets itself up with version of mysql 8.0.15. There isn’t any place where it can be changed. I didn’t pay attention when creating my website and now it is not possible to export it to the online version because my host company database is in 5.6 whereas the Local version is in 8.0.15. Isn’t there any other solution for me here ?

@Entourage mysql 8.0.16 is the only version currently available in the Local version 5 beta.

I would suggest you install Local version 3 (it can run alongside version 5 so no need to uninstall the version you currently have): Local by Flywheel 3.3.0

Import your site into Local version 3 and you will have the option to use mySQL 5.6

1 Like

Thanks for this! I just did, but when I try to import the previous website (in a zip file created earlier today) into this version of local (after having taken the time to set up the correct preferences in the custom menu), I get an error message:

"

I am stuck again!!
thank you for your time and help

@Entourage Let’s try moving the site the good old fashioned way then, without Local’s export/import.

  • Set up a new site in Local version 3
  • Navigate to the /public/ folder for this new site, and delete wp-content
  • In Local version 5, go to the “database” tab in the site you want to move and click “open adminer”. Click “export” and make sure “save” is checked. The settings should look like this:

  • Click export
  • Copy the wp-content folder from the site you want to move, to the /public/ folder of the new site (where you just deleted wp-content from)
  • Go to adminer in the new site (in Local version 3) and delete all tables from the database, then import the sql file you just created
  • Edit the wp_options table so “siteurl” and “home” both contain the url of the new site

Let me know how this goes!

1 Like

Hey thanks again.
I did all this, and after trying to import the sql file I get an error again!

Isn’t it because the mysql versions are different?

@Entourage Almost there! Do you have a text editor like VS Code that you can use to perform a “find and replace”? If so, open the sql file in the text editor and perform a find & replace to replace utf8mb4_0900_ai_ci with utf8mb4_unicode_ci. Make sure all instances have been changed and save the file.

Delete all tables in the database again, and try importing the new file.

1 Like

I just did, but I forgot to delete the existing tables before importing the edited sql file, and I cannot find the option to delete them now…I am so stupid…

@Entourage Check all then hit “Drop”

1 Like

Ok, great it seems to have worked, thanks.
So now I suppose I get back to that point:

  • Edit the wp_options table so “siteurl” and “home” both contain the url of the new site
    And where do I do that? It is when clicking on it in the tables and going to the select data window? correct?
    Also when you talk about “the URL of the new site” you mean the second local version of my website or the final URL on which the final website will be available?

@Entourage Awesome, glad I could help!

Yep simply go to the select data window of wp_options, and edit the values of siteurl and home. They should be the local URL, not the live URL.

If the site in version 5 and version 3 are both named the same thing, you probably won’t need to change anything.

1 Like

So let me get this straight : I copy the new address (the one of the website created in local 3) and paste it into both fields home and url in the table and then hit save.
After that, the new website should be accessible through my internet browser, and should look exactly like the first one created in Local 5 correct?

@Entourage That is correct

Ok then I don’t know why, but the page doesn’t load. it stays black with the address bar charging but nothing happens :-/

It actually does that with the other version as well after checking (local 5)

@Entourage Could you attach a screenshot?

A couple of things to try would be restarting the site in Local, and trying to open the site in a new incognito tab

Edit: if it’s happening in Local 5 too, the above ^ probably won’t help

@Entourage could you check your hosts file to make sure the domain is being mapped correctly?

To do this open terminal and type: sudo nano /etc/hosts

Then you’ll be prompted to type in your admin password.

If you could paste the contents of that file in here I can have a look at what’s doing on with the domain mapping.

In Local 3 when restarting it it tells me that local machine isn’t running so I hit start local machine. and in Local 5 it gives me a message of error it gave me earlier and that I thought I had fixed by pressing the corresponding button, but apparently it didn’t…

: