How to install MariaDB 10.1 and Run Various MariaDB Queries in Debian

To install MariaDB 10.1 and Run Various MariaDB Queries in Debian

MariaDB is a drop-in replacement for MySQL. It is an opensource Relational Database Management System (RDBMS) which supports database access. It is a logical choice for database professionals looking for a robust, scalable, and reliable SQL server. Installation of MariaDB 10.1 is explained in this article.

Features

  • Data on disk is encrypted.
  • Optimistic parallel replication
  • InnoDB/XtraDB page compression for FusionIO
  • Built-in galera cluster support which is a true multi-master replication solution

Install the software-properties-common package before installing mariadb repositories.

root@linuxhelp:~# apt-get install software-properties-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libkeybinder0 python-keybinder
.
.
.
Setting up software-properties-common (0.92.25debian1) ...
Processing triggers for systemd (215-17+deb8u3) ...
Processing triggers for dbus (1.8.20-0+deb8u1) ...

Now register and import the GPG key.

root@linuxhelp:~# apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.FIfOKbhu2g --no-auto-check-trustdb --trust-model always --primary-keyring /etc/ap
.
.
.
gpg: Total number processed: 1
gpg:               imported: 1

Add the MariaDB repository into the Debian machine.

root@linuxhelp:~# add-apt-repository ' deb [arch=64,i386] http://mirrors.opencas.cn/mariadb/repo/10.1/debain ' $(lsb_release -cs)'  main' 

After adding the repository, update your Debian machine.

root@linuxhelp:~# apt-get update
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Get:2 http://ftp.debian.org jessie-updates InRelease [142 kB]                        
Ign http://ftp.de.debian.org wheezy InRelease           
.
.
.
Fetched 41.3 MB in 2min 42s (254 kB/s)                                               
Reading package lists... Done

Now install the MariaDB package by using the following command.

root@linuxhelp:~# apt-get install mariadb-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
.
.
.
Processing triggers for libc-bin (2.19-18+deb8u2) ...
Processing triggers for menu (2.1.47) ...
Processing triggers for systemd (215-17+deb8u3) ...
Enter the new password for the root user.
MariaDB 10.1

Click yes to migrate to MariaDB.
ok

Login to MariaDB with root password

root@linuxhelp:~#mysql &ndash u root &ndash p
Enter Password:
login

To List the database available in your MariaDB

MariaDb=B[(none)]>  show databases 
database

To Use the database

MariaDB [(none)]>  use mysql 
use db

To List the tables of mariadb

MariaDB [mysql]>  show tables 
tables

To Use the tables

MariaDB [mysql]>  describe user 
describe

To Create mariadb user

MariaDB [(none)]>  create user ' user 1'  identified by ' user@123'  
createuser

To Login with created user

root@linuxhelp:~# mysql -u user1 -p
loginuser

To view the grant details

MariaDB [(none)]>  show grants 
grant

To view the status of mariadb

MariaDB [(none)]>  show status 
status

To view the process list of mariadb

MariaDB [(none)]>  show processlist 
processs
Tag : MariaDB
FAQ
Q
What is mean by mariadb?
A
MariaDB Server is one of the most popular database servers in the world. It's made by the original developers of MySQL and guaranteed to stay open source.
Q
I installed mariadb sever on opensuse when is try to start mariadb service in open i got below error.. Please tell some alternative commands to start mariadb service?
A
Please run the following command as "systemctl start mariadb'
don’t using the mysql instead of mariadb
Q
How to create the database user?
A
Need to open a database console using the root user privilege. Then you can create the user as shown below
"create user 'user 1' identified by 'user@123';"
Q
How to open a database by using the "root" user credential?
A
You can use the following syntax to open a database by using the "root" user crendential.
For syntax: "mysql -u root -p".
Q
What is the framework independent database source?
A
Here I have mentioned some of the framework independent database source,
1. ODBC (Open Database Connectivity)
2. JDBC (Java Database Connectivity)
3. Perl
4. PHP PDO MySQL driver