# mariadb105-server-10.5.13 removes p5-DBD-MariaDB and vice versa



## mack3457 (Feb 15, 2022)

When installing the mariadb server, p5-DBD-MariaDB will get automatically removed and vice versa.

As I need both, I'm confused as to what perl DBD module I should use instead and why it's removing the perl module anyway.

Can anyone shed some light onto this problem?


----------



## VladiBG (Feb 15, 2022)

When the pkg of p5-DBD-MariaDB was build it was build against mysql57-client which conflict with mariadb105-client. Your option at the moment is to build it from ports after you install mariadb server and mariadb client so this way p5-DBd-MariaDB will depend only on perl5,p5-DBI,mariadb105-client.






						FreshPorts -- databases/p5-DBD-MariaDB: MariaDB driver for the Perl5 Database Interface (DBI)
					

DBD::MariaDB is the Perl5 Database Interface driver for MariaDB and MySQL databases. In other words: DBD::MariaDB is an interface between the Perl programming language and the MariaDB/MySQL programming API that comes with the MariaDB/MySQL relational database management system. Most functions...




					www.freshports.org
				






> Library dependencies:
> 
> libmysqlclient.so.20 : databases/mysql57-client
> There are no ports dependent upon this port


----------



## mack3457 (Feb 15, 2022)

Thanks, this works fine.


----------



## VladiBG (Feb 15, 2022)

If you just start using ports for the first time, then all future updates need to be only from ports. Don't mix the pkg with ports otherwise you will end up with mismatching library dependencies.


----------



## VladiBG (Feb 15, 2022)

This turn out to be more complicated than I thought. In the Makefile of p5-DBD-MariaDB there's USES Macro for mysql (/usr/ports/Mk/Uses/mysql.mk) in which flavors of MySQL clients are defined using:


```
# Port requested a version
.if !empty(_MYSQL_ARGS)
_WANT_MYSQL_VER=        ${_MYSQL_ARGS}
.if   (${_WANT_MYSQL_VER:C/[0-9]*//} == "m")
_WANT_MYSQL_FLAVOUR=    mariadb
.elif (${_WANT_MYSQL_VER:C/[0-9]*//} == "p")
_WANT_MYSQL_FLAVOUR=    percona
.else
_WANT_MYSQL_FLAVOUR=    mysql
```

So to fix this the port maintainer can use:


```
# MySQL client version currently supported.
# When adding a version, please keep the comment in
# Mk/bsd.default-versions.mk in sync.
.for v in 55 55m 56 56p 56w 100m 101m
MYSQL${v}_LIBVER=       18
.endfor
MYSQL57_LIBVER=         20
MYSQL57p_LIBVER=        20
MYSQL80_LIBVER=         21
MYSQL102m_LIBVER=       3
MYSQL103m_LIBVER=       3
MYSQL104m_LIBVER=       3
MYSQL105m_LIBVER=       3
```

in Makefile


```
USES=                   compiler:c11 mysql:105m perl5
```
Instead of

```
USES=                   compiler:c11 mysq perl5
```

This will define the USES macro to use a flavor for mariadb10.5 but this will break the other installations of old mariadb 10.3, 10.4...


----------



## SirDice (Feb 16, 2022)

The correct way to do this is to add to /etc/make.conf:

```
DEFAULT_VERSIONS+= mysql=105m
```

Then all ports that have a `USES= mysql` will depend on databases/mariadb105-client instead of databases/mysql57-client.

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


----------



## VladiBG (Feb 16, 2022)

p5-DBD-MariaDB should be build for MariaDB by default so when it's installed via pkg to install mariadbXX-client instead of mysqlXX-client. When it's build from the ports the USES Macro picks already installed version between MySQL or MariaDB and it is build with the client of it but if it doesn't found any of them then it go to default of MySQL client.


----------

