MariaDB Installation

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

Linux

Prerequisites

  • The host name should be resolvable with resolveip.

RHEL 7

⚠️ After installation, make sure you go through the Post-Install steps, described below.

MariaDB 10 and Newer

As root:

cd ~/tmp
wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
chmod +x mariadb_repo_setup
./mariadb_repo_setup
yum install -y MariaDB-server
systemctl enable mariadb.service
systemctl start mariadb.service

MariaDB 5

yum install -y mariadb-server mariadb

Post-Install

MariaDB Configuration - Post Install

Uninstallation

Uninstallation with state removal:

systemctl stop mariadb.service
systemctl disable mariadb.service
yum remove mariadb-server mariadb
# remove data
rm -r /var/lib/mysql
# remove logs
rm -r /var/log/mariadb
rm -r /var/run/mariadb

Mac

brew install mariadb

Post-Install Configuration

Immediately after installation, start the database as described in To Start at Boot and run mysql_secure_installation.

As configured by the initial installation, the script has to be run by root, which authenticates itself using system credential. In consequence, mysql_secure_installation must be used as sudo:

sudo /opt/brew/bin/mysql_secure_installation

[...]
Enter current password for root (enter for none):
OK, successfully used password, moving on...
[...]
Switch to unix_socket authentication [Y/n] n
... skipping.
Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
[...]
Remove anonymous users? [Y/n] Y
[...]
Disallow root login remotely? [Y/n] Y
[...]
Remove test database and access to it? [Y/n] Y
[...]
Reload privilege tables now? [Y/n] Y
[...]
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

To Start at Boot

brew services start mariadb

To Start When Needed

To run on demand:

/opt/brew/opt/mariadb/bin/mysqld_safe --datadir\=/opt/brew/var/mysql

Connect

mysql -u root -p
[...]
MariaDB [(none)]>