How to install MariaDB 5.5 Database
To install MariaDB 5.5 Database
This tutorial explains the installation of MariaDB 5.5 database with examples. MariaDB is alternative for MySQL which has more features and improved performance. Distributions and websites like Mozilla Corporation, ArchLinux, OpenSuse, Wikipedia, OLX, SlashGear, RHEL 7, Gentoo have changed to MariaDB.
Installation of MariaDB
It is preferred to Install through custom MariaDB YUM (Package Manager) repository. The file path of the repo file to be created is /etc/yum.repos.d/MariaDB.repo Copy and paste the suitable entry from the below
Create a new MariaDB repo file in the “ yum.repos.d” directory. It is available for OS versions like RHEL 7 64bit,RHEL 6, CentOS 7-64bit,CentOS 6,Ubuntu 14.04, 12.04
On RHEL 7 64-bit
# MariaDB 5.5 RedHat repository list - created 2016-04-05 12:25 UTC # http://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/5.5/rhel7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
On RHEL 6 32-bit
# MariaDB 5.5 RedHat repository list - created 2013-08-11 14:29 UTC # http://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/5.5/rhel6-x86 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
On RHEL 6 64-bit
# MariaDB 5.5 RedHat repository list - created 2013-08-11 14:30 UTC # http://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/5.5/rhel6-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
On Centos 7 64-Bit
# MariaDB 5.5 CentOS repository list - created 2016-04-05 12:22 UTC # http://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/5.5/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
On CentOS 6 32-bit
# MariaDB 5.5 CentOS repository list - created 2013-08-11 14:21 UTC # http://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/5.5/centos6-x86 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
On CentOS 6 64-bit
# MariaDB 5.5 CentOS repository list - created 2013-08-11 14:22 UTC # http://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/5.5/centos6-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
Install MariaDB server and client
Start the installation process, once the MariaDB.repo file is created in the /etc/yum.repos.d/
On RHEL/CentOS
[root@linuxhelp Desktop]# yum install MariaDB-server MariaDB-client
Resolving Dependencies
--> Running transaction check
---> Package MariaDB-client.x86_64 0:5.5.48-1.el7.centos will be installed
--> Processing Dependency: MariaDB-common for package: MariaDB-client-5.5.48-1.el7.centos.x86_64
---> Package MariaDB-server.x86_64 0:5.5.48-1.el7.centos will be installed
--> Processing Dependency: perl(DBI) for package: MariaDB-server-5.5.48-1.el7.centos.x86_64
.
.
.
Dependency Installed:
MariaDB-common.x86_64 0:5.5.48-1.el7.centos perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7
perl-Compress-Raw-Zlib.x86_64 1:2.061-4.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
Replaced:
mariadb-libs.x86_64 1:5.5.35-3.el7
Complete!
Now the MariaDB installation is successfully completed.
To start the MariaDB service
Execute the following command to start the MariaDB service.
On RHEL/CentOS 6
[root@linuxhelp Desktop]# /etc/init.d/mysql start
Starting MySQL.. SUCCESS!
To login MariaDB
Execute mysql command in the terminal. The root password is blank by default.
[root@linuxhelp Desktop]# mysql Welcome to the MariaDB monitor. Commands end with or g. Your MariaDB connection id is 3 Server version: 5.5.48-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type ' help ' or ' h' for help. Type ' c' to clear the current input statement. MariaDB [(none)]>
To view the current database
The following command is used to list the all databases.
MariaDB [(none)]> show databases +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | +--------------------+ 4 rows in set (0.00 sec) MariaDB [(none)]>
Always end the commands with semi-colon in MariaDB prompt as shown above.
To exit from the shell
Type exit (or) quit in the terminal to exit from the shell.
MariaDB [(none)]> exit
Bye
To Do’ s after the fresh installation of MariaDB and to harden the security of MariaDB
This step consist of options to set root password, removing anonymous users, disallowing remote root login, remove the test database and secure access to MariaDB.
[root@linuxhelp Desktop]# mysql_secure_installation 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): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from ' localhost' . This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y ... Success! By default, MariaDB comes with a database named ' test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you' ve completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
To restart MariaDB
By restarting the service, the settings done in the above step takes effect on MariaDB database
On RHEL/CentOS 6
[root@linuxhelp Desktop]# /etc/init.d/mysql restart
Shutting down MySQL. SUCCESS!
Starting MySQL.. SUCCESS!
Now we have completed post installation procedures, let we try logging in now
Initially we just entered “ mysql” to log into MariaDB but after setting password,if we run the same command we get an error on permission issues. So use the below command which asks to enter the password of root user.
[root@linuxhelp Desktop]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with or g. Your MariaDB connection id is 3 Server version: 5.5.48-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type ' help ' or ' h' for help. Type ' c' to clear the current input statement. MariaDB [(none)]> exit Bye
To enable MariaDB
Run the following command to enable the mysql.
[root@linuxhelp Desktop]# chkconfig mysql on
To install MariaDB 5.5 database
Execute the following commands to install MariaDB database on Debian 7 Wheezy and Debian 6 Squeeze
user1@linuxhelp:~$ sudo apt-get install python-software-properties
user1@linuxhelp:~$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
Copy and paste the following entries into a file /etc/apt/sources.list at the bottom.
On Debian 7 Wheezy
# MariaDB 5.5 repository list - created 2013-08-11 15:03 UTC # http://mariadb.org/mariadb/repositories/ deb http://mirrors.scie.in/mariadb/repo/5.5/debian wheezy main deb-src http://mirrors.scie.in/mariadb/repo/5.5/debian wheezy main
On Ubuntu 14.04 trusty
# MariaDB 5.5 repository list - created 2016-04-12 11:56 UTC # http://mariadb.org/mariadb/repositories/ deb [arch=amd64,i386] http://mirror.fibergrid.in/mariadbrepo/5.5/ubuntu trusty main deb-src http://mirror.fibergrid.in/mariadbrepo/5.5/ubuntu trusty main
Now you can install MariaDB with apt-get command after importing the key and added repository.
user1@linuxhelp:~$ sudo apt-get update
user1@linuxhelp:~$ sudo apt-get install mariadb-server
Comments ( 0 )
No comments available