# Upgrading MySQL 5 to 8 (building before uninstalling)



## scotia (Apr 22, 2020)

Hi,

I want to keep my 5.7 MySQL server running for a long as possible before shutting it down and installing MySQL 8.

And I'd like to know that I can compile 8 beforehand too.

When I go to make MySQL 8 I get:


```
/usr/ports/databases/mysql80-server# make
===>  mysql80-server-8.0.19_2 cannot install: MySQL versions mismatch:
mysql56-client is installed and wanted version is mysql80-client.
*** Error code 1

Stop.
```

Which is a bit misleading.  It says _cannot install_ even though I'm not trying to install it.

Anyway, is there a good methodology for these types of upgrades?  Ensuring a build before shutting down and deinstalling the running software?

Thanks.


----------



## SirDice (Apr 22, 2020)

scotia said:


> Anyway, is there a good methodology for these types of upgrades?


I have my own repositories, built with poudriere(8). I'd create different repositories, one based on MySQL 5.7 and one based on MySQL 8. Switching a machine is as easy as switching repositories. This is what I did to upgrade a client's machines from MySQL 5.5 to 5.6 and then to 5.7. It took a few steps but it was painless and uneventful,  a perfect upgrade.


----------



## scotia (Apr 23, 2020)

Thanks SirDice I was worried you were going to say that.  I do have an instance of poudriere I used for cross-builds so I figure I can use that.

A couple of questions if you don't mind:
1) the poudriere machine is running 12.1 but my target machine is 11.3.  Can I still build?
2) How do I point my target machine to the poudriere-built packages (in the past I've just copied them over but I'm sure there's a better way)?

Thanks


----------



## SirDice (Apr 23, 2020)

scotia said:


> the poudriere machine is running 12.1 but my target machine is 11.3. Can I still build?


Yes, that's not a problem. 


scotia said:


> How do I point my target machine to the poudriere-built packages (in the past I've just copied them over but I'm sure there's a better way)?


I have a simple nginx configuration. This provides a nice web interface to Poudriere and I also use it to export the repositories. Have a look at /usr/local/share/examples/poudriere/nginx.conf.sample or /usr/local/share/examples/poudriere/httpd.conf.sample if you want to use Apache.

For exposing the repositories I simply added this:

```
location /packages {
                alias /usr/local/poudriere/data/packages;

                fancyindex on;
                }
```


```
# ll /usr/local/poudriere/data/packages/
total 45
drwxr-xr-x  8 root  wheel  17 Apr 23 01:33 12-stable-desktop/
drwxr-xr-x  7 root  wheel  16 Apr 22 23:08 12-stable-server/
drwxr-xr-x  7 root  wheel  15 Apr 20 09:45 121-release-desktop/
drwxr-xr-x  7 root  wheel  15 Apr 23 01:33 121-release-server/
lrwxr-xr-x  1 root  wheel  18 Dec 26 17:22 FreeBSD:12:amd64@ -> 121-release-server
```


----------



## tingo (Apr 23, 2020)

scotia said:


> Which is a bit misleading. It says _cannot install_ even though I'm not trying to install it.


You need to read it again: it says clearly that it is trying to install mysql80-client (mysql-client is required by mysql-server) but cannot, as mysql56-client is already installed...


----------



## scotia (Apr 23, 2020)

tingo good point.  I missed that.  It's a shame FreeBSD doesn't allow staging of dependencies (that I know of).  i.e. build everything with "make" then (try to) install everything with "make install".


----------

