RHEL 7 comes with MariaDB by default. Don’t get surprised if you don’t see MySQL server specific packages being displayed through YUM search utility. While most of your applications still uses MySQL in older generation of RHEL 6 or CentOS 6, migrating to newer RHEL 7 or CentOS 7 might require MariaDB configuration. This post will help you get started with MariaDB Up and Running.
Installing MariaDB:
[root@collabnix ~]# yum install mariadb mariadb-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos-hcm.viettelidc.com.vn
* epel: epel.mirror.net.in
* extras: centos-hn.viettelidc.com.vn
* updates: centos-hcm.viettelidc.com.vn
Package 1:mariadb-5.5.44-2.el7.centos.x86_64 already installed and latest version
Resolving Dependencies
–> Running transaction check
—> Package mariadb-server.x86_64 1:5.5.44-2.el7.centos will be installed
–> Processing Dependency: perl-DBI for package: 1:mariadb-server-5.5.44-2.el7.centos.x86_64
–> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.44-2.el7.centos.x86_64
–> Processing Dependency: perl(DBI) for package: 1:mariadb-server-5.5.44-2.el7.centos.x86_64
–> Running transaction check
—> Package perl-DBD-MySQL.x86_64 0:4.023-5.el7 will be installed
—> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
–> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
–> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
–> Running transaction check
—> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
–> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
–> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
–> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
–> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
–> Running transaction check
—> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
–> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
–> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
—> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
–> Running transaction check
—> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
—> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
–> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository
Size
================================================================================
Installing:
mariadb-server x86_64 1:5.5.44-2.el7.centos base 11 M
Installing for dependencies:
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k
perl-DBD-MySQL x86_64 4.023-5.el7 base 140 k
perl-DBI x86_64 1.627-4.el7 base 802 k
perl-IO-Compress noarch 2.061-2.el7 base 260 k
perl-Net-Daemon noarch 0.48-5.el7 base 51 k
perl-PlRPC noarch 0.2020-14.el7 base 36 k
Transaction Summary
================================================================================
Install 1 Package (+7 Dependent packages)
Total download size: 12 M
Installed size: 59 M
Is this ok [y/d/N]: y
Downloading packages:
(1/8): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:01
(2/8): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm | 57 kB 00:00
(3/8): perl-DBD-MySQL-4.023-5.el7.x86_64.rpm | 140 kB 00:00
(4/8): perl-DBI-1.627-4.el7.x86_64.rpm | 802 kB 00:01
(5/8): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00
(6/8): perl-PlRPC-0.2020-14.el7.noarch.rpm | 36 kB 00:00
(7/8): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00
(8/8): mariadb-server-5.5.44-2.el7.centos.x86_64.rpm | 11 MB 00:19
——————————————————————————–
Total 627 kB/s | 12 MB 00:19
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 1/8
Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 2/8
Installing : perl-IO-Compress-2.061-2.el7.noarch 3/8
Installing : perl-Net-Daemon-0.48-5.el7.noarch 4/8
Installing : perl-PlRPC-0.2020-14.el7.noarch 5/8
Installing : perl-DBI-1.627-4.el7.x86_64 6/8
Installing : perl-DBD-MySQL-4.023-5.el7.x86_64 7/8
Installing : 1:mariadb-server-5.5.44-2.el7.centos.x86_64 8/8
Verifying : perl-Net-Daemon-0.48-5.el7.noarch 1/8
Verifying : 1:mariadb-server-5.5.44-2.el7.centos.x86_64 2/8
Verifying : perl-IO-Compress-2.061-2.el7.noarch 3/8
Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 4/8
Verifying : perl-PlRPC-0.2020-14.el7.noarch 5/8
Verifying : perl-DBI-1.627-4.el7.x86_64 6/8
Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 7/8
Verifying : perl-DBD-MySQL-4.023-5.el7.x86_64 8/8
Installed:
mariadb-server.x86_64 1:5.5.44-2.el7.centos
Dependency Installed:
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7
perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
perl-DBD-MySQL.x86_64 0:4.023-5.el7
perl-DBI.x86_64 0:1.627-4.el7
perl-IO-Compress.noarch 0:2.061-2.el7
perl-Net-Daemon.noarch 0:0.48-5.el7
perl-PlRPC.noarch 0:0.2020-14.el7
Complete!
Enabling MariaDB services:
[root@collabnix ~]# systemctl start mariadb.service
[root@collabnix ~]# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@collabnix ~]# /usr/bin/mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
Enter current password for root (enter for none):
Aborting!
Cleaning up…
[root@collabnix ~]# /usr/bin/my
myisamchk mysql_find_rows
myisam_ftdump mysql_fix_extensions
myisamlog mysqlhotcopy
myisampack mysqlimport
my_print_defaults mysql_install_db
mysql mysql_plugin
mysqlaccess mysql_secure_installation
mysqladmin mysql_setpermission
mysqlbinlog mysqlshow
mysqlbug mysqlslap
mysqlcheck mysqltest
mysql_convert_table_format mysql_tzinfo_to_sql
mysqld_multi mysql_upgrade
mysqld_safe mysql_waitpid
mysqldump mysql_zap
mysqldumpslow
[root@collabnix ~]# /usr/bin/mysqladmin -u root password ‘mysql123’
[root@collabnix ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.44-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]>
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> create database my_wiki;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> GRANT INDEX, CREATE, SELECT, INSERT, UPDATE, DELETE, ALTER, LOCK TABLES ON my_wiki.* TO ‘root’@’localhost’ IDENTIFIED BY ‘password’;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
[root@collabnix ~]#