Comments - Mariadb-libs installation conflicts with existing MySQL community libs

6 years, 7 months ago kanika satija
This comment has the status of 'removed' and can only be seen by you.

MySQL and MariaDB both the instances can coexist. But MariaDB is to be installed to a non-standard directory. Please follow below steps to do the same:- 1) Download the compiled binary tar.gz (mariadb-5.5.24-linux-x86_64.tar.gz)

2) Create data directory and symlinks a) mkdir mariadb-data b) ln -s mariadb-5.5.24-linux-x86_64 mariadb c) groupadd --system mariadb d) useradd -c "MariaDB Server" -d /opt/mariadb -g mariadb --system mariadb e) chown -R mariadb:mariadb mariadb-5.5.24-linux-x86_64/ f) chown -R mariadb:mariadb mariadb-data/

3) Create a new my.cnf in /opt/mariadb from support files: a) cp mariadb/support-files/my-medium.cnf mariadb-data/my.cnf b) chown mariadb:mariadb mariadb-data/my.cnf

4) Edit the file /opt/mariadb-data/my.cnf and add custom paths, socket, port, user and the most important of all: data directory and base directory [client] port = 3307 socket = /opt/mariadb-data/mariadb.sock

[mysqld] datadir = /opt/mariadb-data basedir = /opt/mariadb port = 3307 socket = /opt/mariadb-data/mariadb.sock user = mariadb

5) Copy the init.d script from support files in the right location: a) cp mariadb/support-files/mysql.server /etc/init.d/mariadb b) chmod +x /etc/init.d/mariadb

6) Edit /etc/init.d/mariadb

a) replacing mysql with mariadb

- # Provides: mysql + # Provides: mariadb - basedir= + basedir=/opt/mariadb - datadir= + datadir=/opt/mariadb-data - lock_file_path="$lockdir/mysql" + lock_file_path="$lockdir/mariadb"

b) $bindir/mysqld_safe --defaults-file=/opt/mariadb-data/my.cnf --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 & c) $bindir/mysqladmin --defaults-file=/opt/mariadb-data/my.cnf ping >/dev/null 2>&1;

7) Run mysql_install_db a) cd mariadb b) scripts/mysql_install_db --defaults-file=/opt/mariadb-data/my.cnf

8) Start MariaDB /etc/init.d/mariadb start

9) To Make MariaDB start at system start a) cd /etc/init.d b) chkconfig --add mariadb c) chkconfig --levels 3 mariadb on

10) Test MariaDB instance is running mysql -e "SELECT VERSION();" --socket=/opt/mariadb-data/mariadb.sock

Just for your information Mariadb is drop-in replacement for mysql. Therefore we can also switch from mysql to mariadb. Please perform below steps to do the same: 1) backup your database just in case there is any issue while switching to mariadb 2) uninstall mysql 3) install mariadb 4) start mariadb services All the databases and information is intact and even there is no need to have mysql dump to be performed to source into mariadb server as that data is already there

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.