# FreeBSD: mariadb55 conflicts with mysql55



## alexus (Oct 25, 2014)

I'm trying to install percona-toolkit as a package/port on my system:


```
[root@alexus ~]# uname -a
FreeBSD alexus.org 9.2-RELEASE-p5 FreeBSD 9.2-RELEASE-p5 #0 r265974: Wed May 14 07:57:04 PDT 2014 root@jj3.myibay.com:/usr/obj/usr/src/sys/R610 amd64
[root@alexus ~]# pkg install percona-toolkit
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking integrity... done (1 conflicting)
Checking integrity... done (0 conflicting)
The following 7 packages will be affected (of 0 checked):

Installed packages to be REMOVED:
mariadb55-client-5.5.39
mariadb55-server-5.5.39

New packages to be INSTALLED:
percona-toolkit: 2.2.11
p5-Term-ReadKey: 2.32
p5-DBI: 1.631
p5-DBD-mysql: 4.028
mysql55-client: 5.5.40

The operation will free 100 MB.

Proceed with this action? [y/N]: n
[root@alexus ~]# cd /usr/ports/databases/percona-toolkit/ && make config
===> No options to configure
[root@alexus /usr/ports/databases/percona-toolkit]#
```

I do _NOT_ wish to remove and/or replace my existing mariadb55-client and/or mariadb55-server with mysql55-client.

What should I do?


----------



## kpa (Oct 25, 2014)

Try this:

`make -C  /usr/ports/databases/percona-toolkit WITH_MYSQL_VER=55m install clean`

Assuming that works you should set the 
	
	



```
WITH_MYSQL_VER=55m
```
 setting in your /etc/make.conf so that all ports that use a MySQL database use the MariaDB ports instead.


----------



## alexus (Oct 25, 2014)

... looks like p5-DBD-mysql is the one 


```
[root@alexus /usr/ports/databases/percona-toolkit]# pkg install p5-DBD-mysql
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking integrity... done (1 conflicting)
Checking integrity... done (0 conflicting)
The following 4 packages will be affected (of 0 checked):

Installed packages to be REMOVED:
    mariadb55-client-5.5.39
    mariadb55-server-5.5.39

New packages to be INSTALLED:
    p5-DBD-mysql: 4.028
    mysql55-client: 5.5.40

The operation will free 107 MB.

Proceed with this action? [y/N]: n
[root@alexus /usr/ports/databases/percona-toolkit]#
```


----------



## alexus (Oct 25, 2014)

kpa said:


> Try this:
> 
> `make -C  /usr/ports/databases/percona-toolkit WITH_MYSQL_VER=55m install clean`
> 
> Assuming that works you should set the WITH_MYSQL_VER=55m setting in your /etc/make.conf so that all ports that use a MySQL database use the MariaDB ports instead.



looks like this is it:


```
[root@alexus /usr/ports/databases/p5-DBD-mysql]# make -C /usr/ports/databases/percona-toolkit WITH_MYSQL_VER=55m build
===>  License ARTPERL10 GPLv2 accepted by the user
===>   percona-toolkit-2.2.11 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by percona-toolkit-2.2.11 for building
===>  Extracting for percona-toolkit-2.2.11
=> SHA256 Checksum OK for percona-toolkit-2.2.11.tar.gz.
===>  Patching for percona-toolkit-2.2.11
===>  Applying FreeBSD patches for percona-toolkit-2.2.11
===>   percona-toolkit-2.2.11 depends on file: /usr/local/bin/perl5.16.3 - found
===>  Configuring for percona-toolkit-2.2.11
Checking if your kit is complete...
Looks good
Warning: prerequisite DBD::mysql 3 not found.
Writing Makefile for percona-toolkit
Writing MYMETA.yml and MYMETA.json
===>  Building for percona-toolkit-2.2.11
cp bin/pt-mysql-summary blib/script/pt-mysql-summary
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-mysql-summary
cp bin/pt-kill blib/script/pt-kill
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-kill
cp bin/pt-online-schema-change blib/script/pt-online-schema-change
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-online-schema-change
cp bin/pt-table-sync blib/script/pt-table-sync
cp bin/pt-upgrade blib/script/pt-upgrade
cp bin/pt-table-usage blib/script/pt-table-usage
cp bin/pt-fifo-split blib/script/pt-fifo-split
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-table-sync
cp bin/pt-slave-find blib/script/pt-slave-find
cp bin/pt-ioprofile blib/script/pt-ioprofile
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-table-usage
cp bin/pt-archiver blib/script/pt-archiver
cp bin/pt-find blib/script/pt-find
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-upgrade
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-fifo-split
cp bin/pt-deadlock-logger blib/script/pt-deadlock-logger
cp bin/pt-fingerprint blib/script/pt-fingerprint
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-slave-find
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-ioprofile
cp bin/pt-mext blib/script/pt-mext
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-archiver
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-find
cp bin/pt-slave-restart blib/script/pt-slave-restart
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-deadlock-logger
cp bin/pt-summary blib/script/pt-summary
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-fingerprint
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-mext
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-summary
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-slave-restart
cp bin/pt-fk-error-logger blib/script/pt-fk-error-logger
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-fk-error-logger
cp bin/pt-table-checksum blib/script/pt-table-checksum
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-table-checksum
cp bin/pt-query-digest blib/script/pt-query-digest
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-query-digest
cp bin/pt-show-grants blib/script/pt-show-grants
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-show-grants
cp bin/pt-pmp blib/script/pt-pmp
cp bin/pt-align blib/script/pt-align
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-pmp
cp bin/pt-slave-delay blib/script/pt-slave-delay
cp bin/pt-heartbeat blib/script/pt-heartbeat
cp bin/pt-sift blib/script/pt-sift
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-align
cp bin/pt-diskstats blib/script/pt-diskstats
cp bin/pt-visual-explain blib/script/pt-visual-explain
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-slave-delay
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-heartbeat
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-sift
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-diskstats
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-visual-explain
cp bin/pt-variable-advisor blib/script/pt-variable-advisor
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-variable-advisor
cp bin/pt-index-usage blib/script/pt-index-usage
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-index-usage
cp bin/pt-duplicate-key-checker blib/script/pt-duplicate-key-checker
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-duplicate-key-checker
cp bin/pt-config-diff blib/script/pt-config-diff
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-config-diff
cp bin/pt-stalk blib/script/pt-stalk
/usr/local/bin/perl5.16.3 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/pt-stalk
Manifying blib/man1/pt-mysql-summary.1
Manifying blib/man1/pt-kill.1
Manifying blib/man1/pt-online-schema-change.1
Manifying blib/man1/pt-table-sync.1
Manifying blib/man1/pt-upgrade.1
Manifying blib/man1/pt-table-usage.1
Manifying blib/man1/pt-fifo-split.1
Manifying blib/man1/pt-slave-find.1
Manifying blib/man1/pt-ioprofile.1
Manifying blib/man1/pt-find.1
Manifying blib/man1/pt-archiver.1
Manifying blib/man1/pt-deadlock-logger.1
Manifying blib/man1/pt-fingerprint.1
Manifying blib/man1/pt-mext.1
Manifying blib/man1/pt-slave-restart.1
Manifying blib/man1/pt-summary.1
Manifying blib/man1/pt-fk-error-logger.1
Manifying blib/man1/pt-table-checksum.1
Manifying blib/man1/pt-query-digest.1
Manifying blib/man1/pt-show-grants.1
Manifying blib/man1/percona-toolkit.1
Manifying blib/man1/pt-pmp.1
Manifying blib/man1/pt-align.1
Manifying blib/man1/pt-heartbeat.1
Manifying blib/man1/pt-slave-delay.1
Manifying blib/man1/pt-sift.1
Manifying blib/man1/pt-diskstats.1
Manifying blib/man1/pt-visual-explain.1
Manifying blib/man1/pt-variable-advisor.1
Manifying blib/man1/pt-index-usage.1
Manifying blib/man1/pt-duplicate-key-checker.1
Manifying blib/man1/pt-config-diff.1
Manifying blib/man1/pt-stalk.1
[root@alexus /usr/ports/databases/p5-DBD-mysql]#
```

Thank you!

Can this be applied towards "pkgng" somehow? or is this only for /usr/ports?


----------



## alexus (Oct 27, 2014)

I'm getting this now whenever trying to upgrade packages on my system:


```
[root@alexus ~]# pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Updating database digests format: 100%
Checking for upgrades (3 candidates): 100%
Checking integrity... done (1 conflicting)
Checking integrity... done (0 conflicting)
The following 4 packages will be affected (of 0 checked):

Installed packages to be REMOVED:
	mariadb55-client-5.5.39
	mariadb55-server-5.5.39

New packages to be INSTALLED:
	mysql55-client: 5.5.40

Installed packages to be REINSTALLED:
	p5-DBD-mysql-4.028 (direct dependency changed)

The operation will free 108 MB.

Proceed with this action? [y/N]: n
[root@alexus ~]#
```


----------



## kpa (Oct 27, 2014)

The official packages are built with default option and dependencies, you have to stop using them now that you have installed customized ports with non-default options and build everything yourself from ports.


----------



## Stavros (Nov 3, 2014)

MariaDB is supposed to be a drop in replacement for MySQL. In this instance you "shouldn't" have to compile from ports.

pkg should have a way to alias one package to another.


----------



## kpa (Nov 3, 2014)

Stavros said:


> MariaDB is supposed to be a drop in replacement for MySQL. In this instance you "shouldn't" have to compile from ports.
> 
> pkg should have a way to alias one package to another.



The old packaging tools never implemented anything to solve this problem. The PKG tools are now merely replicating the same functionality when it comes to dependencies, they are "set in stone" at package creation time. What would be needed is "virtual dependencies" a la Debian's DPKG system where a package can depend on an abstract entity, let's say "MySQL compatible DB server" and installing the MariaDB server package would then satisfy the dependency. This kind of functionality is still very far away from reality unfortunately.


----------



## Stavros (Nov 3, 2014)

Virtual dependencies require explicit declaration by the package maintainer. It would be really worthwhile if pkg could be configured to substitute one package with another. This way any package which has not been upgraded to use the virtual dependency would still work. Just like editing /etc/make.conf as indicated above (for ports).


----------



## kpa (Nov 3, 2014)

Stavros said:


> Virtual dependencies require explicit declaration by the package maintainer. It would be really worthwhile if pkg could be configured to substitute one package with another. This way any package which has not been upgraded to use the virtual dependency would still work. Just like editing /etc/make.conf as indicated above (for ports).



The information that the two packages are interchangeable would still have to be recorded somewhere and I can not think of any other place than the port Makefiles. I don't think it's a good idea to leave it to the user to try if two packages happen to be interchangable, there should be a proper method for declaring the fact and PKG should then evaluate the conditions for the substition and decide if it's possible or not.


----------



## NewGuy (Nov 6, 2014)

Have you tried locking the package you do not want removed? pkg has a lock feature which is supposed to prevent an installed package from being altered/upgraded/removed.


----------



## alexus (Nov 6, 2014)

NewGuy said:


> Have you tried locking the package you do not want removed? pkg has a lock feature which is supposed to prevent an installed package from being altered/upgraded/removed.




```
[root@j ~]# pkg lock mariadb55-client
mariadb55-client-5.5.39: lock this package? [y/N]: y
Locking mariadb55-client-5.5.39
[root@j ~]# pkg lock mariadb55-server
mariadb55-server-5.5.39: lock this package? [y/N]: y
Locking mariadb55-server-5.5.39
[root@j ~]# pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking for upgrades (4 candidates):  25%

mariadb55-client-5.5.39 is locked and may not be modified

mariadb55-server-5.5.39 is locked and may not be modified

mariadb55-client-5.5.39 is locked and may not be modified
Checking for upgrades (4 candidates): 100%
Checking integrity... done (1 conflicting)
Checking integrity... done (0 conflicting)
The following 4 packages will be affected (of 0 checked):

Installed packages to be REMOVED:
    mariadb55-client-5.5.39
    mariadb55-server-5.5.39

New packages to be INSTALLED:
    mysql55-client: 5.5.40

Installed packages to be REINSTALLED:
    p5-DBD-mysql-4.028 (direct dependency changed)

The operation will free 108 MB.

Proceed with this action? [y/N]: n
[root@j ~]#
```


----------



## rustyx (Apr 28, 2017)

Any news about it? I can't install zabbix because it requires mysql56-client, whereas I use mariadb101-client, which pkg really wants to delete.


----------



## SirDice (Apr 28, 2017)

rustyx said:


> Any news about it?


There is no news. You simply cannot change package dependencies. If you want to deviate from the default you will have to build from ports. In order to set the MySQL dependency to MariaDB you will need to add to /etc/make.conf:

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

See /usr/ports/Mk/bsd.default-versions.mk


----------



## rustyx (Apr 28, 2017)

I'm aware of the ports approach, have been using it for decades. I just though the new package subsystem has matured sufficiently to never require ports. Apparently not.


----------



## gkontos (Apr 28, 2017)

rustyx said:


> I'm aware of the ports approach, have been using it for decades. I just though the new package subsystem has matured sufficiently to never require ports. Apparently not.


Packages have dependencies also. Use ports when you want to deviate from the default or even better use a tool like ports-mgmt/poudriere to maintain your own custom repo.


----------



## rudyrockstar (May 14, 2017)

To work around the MariaDB / MySQL client conflict (FreeBSD 11.0-RELEASE-p9 / Perl v5.24.1).. this worked for me.
# perl -CPAN -e shell
cpan> install DBD::mysql


----------



## gkontos (May 14, 2017)

rudyrockstar said:


> To work around the MariaDB / MySQL client conflict (FreeBSD 11.0-RELEASE-p9 / Perl v5.24.1).. this worked for me.
> # perl -CPAN -e shell
> cpan> install DBD::mysql


No, you should not do that. Just choose the correct port options.


----------



## rudyrockstar (May 14, 2017)

gkontos said:


> No, you should not do that. Just choose the correct port options.


I will continue to do this until there is a more comprehensive maintainable solution that does not inherently pose a security risk. I am able to effortlessly maintain this implementation without any of the negative impacts I have seen attributed to other paths (of "correct port options") of solving this problem.  I will not engage further discussion on this. I was sharing a solution, that can get the average developer back to coding and away from administrative muddling -- not seeking advice.


----------



## gkontos (May 15, 2017)

rudyrockstar said:


> I will not engage further discussion on this. I was sharing a solution, that can get the average developer back to coding and away from administrative muddling -- not seeking advice.



I really don't care if you do. This is a public forum. I had to point out that your solution might be dangerous. Because when you upgrade a system mixing ports or packages you should not use perl -CPAN.


----------

