# Migrating from MySQL to Percona Issue



## Mayhem30 (Sep 1, 2019)

I'm trying to migrate from databases/mysql56-server to databases/percona56-server. I'm using ports-mgmt/synth to compile everything.

When I go to install it, PKG wants to remove Postfix, Dovecot and Sphinxsearch - which I still need installed on the server.

How do I prevent this from happening?


```
$ pkg install -n databases/percona56-server
Updating Synth repository catalogue...
Synth repository is up to date.
All repositories are up to date.
Checking integrity... done (3 conflicting)
  - percona56-server-5.6.45.86.1 conflicts with mysql56-server-5.6.45 on /usr/local/bin/innochecksum
  - percona56-client-5.6.45.86.1 conflicts with mysql56-client-5.6.45 on /usr/local/bin/msql2mysql
  - percona56-client-5.6.45.86.1 conflicts with mysql56-client-5.6.45 on /usr/local/bin/msql2mysql
Checking integrity... done (0 conflicting)
The following 7 package(s) will be affected (of 0 checked):

Installed packages to be REMOVED:
        dovecot-2.3.7.2
        mysql56-client-5.6.45
        mysql56-server-5.6.45
        sphinxsearch-2.2.11_3
        postfix-3.4.6,1

New packages to be INSTALLED:
        percona56-server: 5.6.45.86.1
        percona56-client: 5.6.45.86.1

Number of packages to be removed: 5
Number of packages to be installed: 2

The operation will free 43 MiB.
```


----------



## SirDice (Sep 2, 2019)

Official packages are built using default settings, and the default MySQL version is MySQL 5.6. If you want/need to deviate from the defaults you will have to build from ports and set `DEFAULT_VERSIONS`.


----------



## spectrum48 (Sep 2, 2019)

Did you set it as a default in /usr/local/etc/synth/LiveSystem-make.conf?

I use MariaDB 10.1 and I have to use:


```
DEFAULT_VERSIONS+= mysql=10.1m
```

You must replace 10.1 with the correct value for Percona 5.6.


----------



## SirDice (Sep 2, 2019)

The correct setting should be:

```
DEFAULT_VERSIONS+= mysql=5.6p
```
If you want to base everything on Percona 5.6. See /usr/ports/Mk/bsd.default-versions.mk.


----------



## Mayhem30 (Sep 2, 2019)

It's still not working for me. I thought it might be an issue with Percona, so I tried to upgrade to MySQL 5.7.

I just changed default_versions in /usr/local/etc/synth/LiveSystem-make.conf to :

```
DEFAULT_VERSIONS += ssl=openssl111 php=7.3 mysql=5.7
```


```
$ sudo synth status
Querying system about current package installations.
Stand by, comparing installed packages against the ports tree.
Scanning existing packages.
These are the ports that would be built ([N]ew, [R]ebuild, [U]pgrade):
  N => databases/mysql57-client
Total packages that would be built: 1


$ sudo synth prepare-system
...
...


$ sudo pkg upgrade                           
Updating Synth repository catalogue...
Synth repository is up to date.
All repositories are up to date.
Checking for upgrades (0 candidates): 100%
Processing candidates (0 candidates): 100%
Checking integrity... done (0 conflicting)
Your packages are up to date.



$ sudo pkg install -n databases/mysql57-client
Updating Synth repository catalogue...
Synth repository is up to date.
All repositories are up to date.
Checking integrity... done (2 conflicting)
  - mysql57-client-5.7.27 conflicts with mysql56-client-5.6.45 on /usr/local/bin/mysql
  - mysql57-client-5.7.27 conflicts with mysql56-client-5.6.45 on /usr/local/bin/mysql
Checking integrity... done (0 conflicting)
The following 7 package(s) will be affected (of 0 checked):

Installed packages to be REMOVED:
        dovecot-2.3.7.2
        mysql56-client-5.6.45
        postfix-3.4.6,1
        mysql56-server-5.6.45
        sphinxsearch-2.2.11_3

New packages to be INSTALLED:
        mysql57-client: 5.7.27
        protobuf: 3.9.1,1

Number of packages to be removed: 5
Number of packages to be installed: 2

The operation will free 62 MiB.
```


----------



## SirDice (Sep 2, 2019)

I'm not sure how Synth handles this but poudriere would automatically rebuild everything that depends on the MySQL client. You may need to start fresh, so it rebuilds everything, before it picks up the change. With a change like this basically everything that normally depends on mysql56-client will need to be rebuilt.


----------



## spectrum48 (Sep 2, 2019)

Mayhem30 said:


> ```
> $ sudo pkg install -n databases/mysql57-client
> 
> [...]
> ...



I use Synth in a different way so maybe I'll say something stupid but I think it's the correct behavior: first you rebuild the Synth repository with another version of MySQL, then you asked pkg to install databases/mysql57-client. 

So pkg had to deinstall conflicting databases/mysql56-client and its dependencies. 

If you also want the versions of Dovecot etc. just rebuild you have to explicitly ask for them:


```
pkg install -n databases/mysql57-client mail/dovecot [...]
```


----------



## Mayhem30 (Sep 2, 2019)

Ok, I have found a work-around. In case anyone else has this issue, what I did was :

Added "mysql=5.7" to DEFAULT_VERSIONS in /usr/local/etc/synth/LiveSystem-make.conf

Then I removed MySQL 5.6 files from the repo, compiled the new MySQL 5.7 files and rebuilt the repository.

```
$ cd /var/synth/live_packages/All
$ rm mysql56-*
$ synth just-build databases/mysql57-client
$ synth just-build databases/mysql57-server
$ synth rebuild-repository
```


Then I installed the MySQL 5.7 server :

```
$ pkg install -n databases/mysql57-server
Updating Synth repository catalogue...
Synth repository is up to date.
All repositories are up to date.
Checking integrity... done (3 conflicting)
  - mysql57-server-5.7.27 conflicts with mysql56-server-5.6.45 on /usr/local/bin/innochecksum
  - mysql57-client-5.7.27 conflicts with mysql56-client-5.6.45 on /usr/local/bin/mysql
  - mysql57-client-5.7.27 conflicts with mysql56-client-5.6.45 on /usr/local/bin/mysql
Checking integrity... done (0 conflicting)
The following 8 package(s) will be affected (of 0 checked):

Installed packages to be REMOVED:
        mysql56-client-5.6.45
        mysql56-server-5.6.45

New packages to be INSTALLED:
        mysql57-server: 5.7.27
        mysql57-client: 5.7.27
        protobuf: 3.9.1,1

Installed packages to be REINSTALLED:
        dovecot-2.3.7.2 (direct dependency changed: mysql57-client)
        postfix-3.4.6,1 (direct dependency changed: mysql57-client)
        sphinxsearch-2.2.11_3 (direct dependency changed: mysql57-client)

Number of packages to be removed: 2
Number of packages to be installed: 3
Number of packages to be reinstalled: 3

The process will require 174 MiB more space.
```


The important note here is that nothing worked for me until I removed the MySQL 5.6 files from the repo. Simply adding the new MySQL 5.7 files without removing the older version did not work.


----------

