How to install MariaDB on CentOS 5.5

First thing I want to try on CentOS 5.5 is mariadb. Fortunately mariadb available in binary for CentOS and don’t force me to install from source like I do with FreeBSD since its not available yet on FreeBSD ports.

I’m going to install mariadb 5.23 and make it as learning media 🙂

Here the steps :

Download mariadb rpm file

Get all rpm file (client and server) from osuosl mirror.

# ls

MariaDB-client-5.2.3-87.el5.i386.rpm  MariaDB-server-5.2.3-87.el5.i386.rpm

Install the files

# rpm -i MariaDB-*

error: Failed dependencies:
libmysqlclient.so.16 is needed by MariaDB-client-5.2.3-87.el5.i386
libmysqlclient.so.16(libmysqlclient_16) is needed by MariaDB-client-5.2.3-87.el5.i386
libmysqlclient_r.so.16 is needed by MariaDB-client-5.2.3-87.el5.i386
libmysqlclient_r.so.16(libmysqlclient_16) is needed by MariaDB-client-5.2.3-87.el5.i386
libmysqlclient.so.16 is needed by MariaDB-server-5.2.3-87.el5.i386
libmysqlclient.so.16(libmysqlclient_16) is needed by MariaDB-server-5.2.3-87.el5.i386
libmysqlclient_r.so.16 is needed by MariaDB-server-5.2.3-87.el5.i386
libmysqlclient_r.so.16(libmysqlclient_16) is needed by MariaDB-server-5.2.3-87.el5.i386
#

Eh, it seem I  must remove mysql first

# yum remove mysql

Loaded plugins: fastestmirror
Setting up Remove Process
Resolving Dependencies
–> Running transaction check
—> Package mysql.i386 0:5.0.77-4.el5_4.2 set to be erased
–> Processing Dependency: libmysqlclient.so.15 for package: dovecot
–> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15) for package: dovecot
–> Running transaction check
—> Package dovecot.i386 0:1.0.7-7.el5 set to be erased
–> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================

=========================
Package                    Arch                    Version                               Repository

Size
====================================================================================================

=========================
Removing:
mysql                      i386                    5.0.77-4.el5_4.2                      installed

7.9 M
Removing for dependencies:
dovecot                    i386                    1.0.7-7.el5                           installed

3.6 M

Transaction Summary
====================================================================================================

=========================
Remove        2 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Is this ok [y/N]:y

Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing        : dovecot

1/2
Erasing        : mysql

2/2

Removed:
mysql.i386 0:5.0.77-4.el5_4.2

Dependency Removed:
dovecot.i386 0:1.0.7-7.el5

Complete!
You have mail in /var/spool/mail/root
#

Hmmm try to reinstall give me libmysqlclient.so.16 error, maybe I must replace it. Google lead me to MySQL-shared-compat.

Install MySQL-shared-compat

# wget -c ftp://mirror.switch.ch/pool/1/mirror/mysql/Downloads/MySQL-6.0/MySQL-shared-compat-6.0.9-0.rhel5.i386.rpm

# rpm -i MySQL-shared-compat-6.0.9-0.rhel5.i386.rpm

Install Mariadb

# rpm -i MariaDB-*

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password ‘new-password’
/usr/bin/mysqladmin -u root -h centos.rasyid.net password ‘new-password’

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the MySQL manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MariaDB is available at http://www.askmonty.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Support MariaDB development by buying support/new features from
Monty Program Ab. You can contact us about this at [email protected].
Alternatively consider joining our community based development effort:
http://askmonty.org/wiki/index.php/MariaDB#How_can_I_participate_in_the_development_of_MariaDB

Starting MySQL…[  OK  ]
Giving mysqld 2 seconds to start
#

Great, seem work. Check the process.

# ps ax | grep sql

8769 pts/0    S      0:00 /bin/sh /usr/bin/mysqld_safe –datadir=/var/lib/mysql –pid-

file=/var/lib/mysql/centos.rasyid.net.pid
8824 pts/0    SNl    0:01 /usr/sbin/mysqld –basedir=/ –datadir=/var/lib/mysql –user=mysql —

log-error=/var/lib/mysql/centos.rasyid.net.err –pid-file=/var/lib/mysql/centos.rasyid.net.pid
8862 pts/0    S+     0:00 grep sql
#

Checking its install presence

# rpm -qa | grep Maria

MariaDB-client-5.2.3-87.el5
MariaDB-server-5.2.3-87.el5

Try to access

# mysql -uroot -p

mysql: error while loading shared libraries: /usr/lib/libmysqlclient.so.16: cannot restore segment prot after reloc: Permission denied
#

Ups, maybe its SE Linux problem.

To Temporarily disable enforcement on a running system

#/usr/sbin/setenforce 0

To permanently disable enforcement during a system startup
change “enforcing” to “disabled” in ”/etc/selinux/config” and reboot.

try to access (again)

# mysql -uroot -p

Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
mysql: relocation error: mysql: symbol mysql_get_server_name, version libmysqlclient_16 not defined

in file libmysqlclient.so.16 with link time reference

AskMonty give me the clue.

# ldd $(which mysql)|grep mysql

libmysqlclient.so.16 => /usr/lib/libmysqlclient.so.16 (0x0055e000)

# rpm -qf /usr/lib/libmysqlclient.so.16

MySQL-shared-compat-6.0.9-0.rhel5
#

Yes, I install wrong file.

#rpm -e MySQL-shared-compat

Reinstall everything will fix it.

Install mariadb on CentOS 5.5

Download one more file (MariaDB-shared) from osuosl mirror.

Install the file one by one.

# rpm -ivh MariaDB-shared-5.2.3-87.el5.i386.rpm

Preparing…                ########################################### [100%]
1:MariaDB-shared         ########################################### [100%]

# rpm -ivh MariaDB-client-5.2.3-87.el5.i386.rpm

Preparing…                ########################################### [100%]
1:MariaDB-client         ########################################### [100%]

# rpm -ivh MariaDB-server-5.2.3-87.el5.i386.rpm

Preparing…                ########################################### [100%]
1:MariaDB-server         ########################################### [100%]

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password ‘new-password’
/usr/bin/mysqladmin -u root -h centos.rasyid.net password ‘new-password’

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This isstrongly recommended for production

servers.

See the MySQL manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MariaDB is available at http://www.askmonty.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Support MariaDB development by buying support/new features from
Monty Program Ab. You can contact us about this at [email protected].
Alternatively consider joining our community based development effort:
http://askmonty.org/wiki/index.php/MariaDB#How_can_I_participate_in_the_development_of_MariaDB

Starting MySQL..[  OK  ]
Giving mysqld 2 seconds to start
#

My bad..my bad, everything seem ok right now.

Check library (again)

# ldd $(which mysql)|grep mysql

libmysqlclient.so.16 => /usr/lib/libmysqlclient.so.16 (0x00ccb000)

# rpm -qf /usr/lib/libmysqlclient.so.16

MariaDB-shared-5.2.3-87.el5

Cool.

Access mariadb

# mysql -uroot -p

Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.2.3-MariaDB-mariadb87 (MariaDB – http://mariadb.com/)

This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| mysql              |
| test               |
+——————–+
3 rows in set (0.00 sec)

MariaDB [(none)]> SHOW ENGINES\G
*************************** 1. row ***************************
Engine: MEMORY
Support: YES
Comment: Hash based, stored in memory, useful for temporary tables
Transactions: NO
XA: NO
Savepoints: NO
*************************** 2. row ***************************
Engine: MRG_MYISAM
Support: YES
Comment: Collection of identical MyISAM tables
Transactions: NO
XA: NO
Savepoints: NO
*************************** 3. row ***************************
Engine: FEDERATED
Support: YES
Comment: FederatedX pluggable storage engine
Transactions: YES
XA: NO
Savepoints: YES
*************************** 4. row ***************************
Engine: BLACKHOLE
Support: YES
Comment: /dev/null storage engine (anything you write to it disappears)
Transactions: NO
XA: NO
Savepoints: NO
*************************** 5. row ***************************
Engine: CSV
Support: YES
Comment: CSV storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 6. row ***************************
Engine: Aria
Support: YES
Comment: Crash-safe tables with MyISAM heritage
Transactions: YES
XA: NO
Savepoints: NO
*************************** 7. row ***************************
Engine: ARCHIVE
Support: YES
Comment: Archive storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 8. row ***************************
Engine: MyISAM
Support: DEFAULT
Comment: Default engine as of MySQL 3.23 with great performance
Transactions: NO
XA: NO
Savepoints: NO
*************************** 9. row ***************************
Engine: InnoDB
Support: YES
Comment: XtraDB engine based on InnoDB plugin. Supports transactions, row-level locking, and

foreign keys
Transactions: YES
XA: YES
Savepoints: YES
*************************** 10. row ***************************
Engine: PBXT
Support: YES
Comment: High performance, multi-versioning transactional engine
Transactions: YES
XA: YES
Savepoints: NO
10 rows in set (0.00 sec)

MariaDB [(none)]>
exit

Checking its version.

# mysql -V

mysql  Ver 14.16 Distrib 5.2.3-MariaDB, for pc-linux-gnu (i686) using readline 5.1

Note :

use su – instead of su on CentOS 🙂

Finally, I can install mariadb on CentOS and refreshing my memory about command in Linux Redhat.

See you in other post.

Stay health!

Tags: