Installasi MariaDB di Centos 6.3

Ok, langsung saja, kita akan melakukan instalasi MariaDB, sebagai pengganti dari MySQL server yg sudah terinstall di Distro Centos 6.3, atau bisa juga dimulai dari fresh install. Jika pembaca ingin mengetahui lebih lanjut tentang MariaDB, silahkan kunjungi disini atau disini.

1. Pertama, cek terlebih dahulu apakah pembaca memiliki MySQL-Server yg sudah terinstall? Jika masih terinstall, remove MySQL-Server berserta dependencinya. Namun, jika pembaca memulai dari fresh install, bisa langsung ke langkah no 2.

[root@dbs ~]# rpm -qa mysql*
mysql-connector-odbc-5.1.5r1144-7.el6.i686
mysql-5.1.67-1.el6_3.i686
mysql-libs-5.1.67-1.el6_3.i686
mysql-server-5.1.67-1.el6_3.i686
[root@dbs ~]#
[root@dbs ~]# yum remove mysql mysql-server -y

2. Tambahkan repository MariaDB, dengan membuat file “mariadb.repo”.

[root@dbs ~]# vim /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
enabled=1

3. Install MariaDB-server dan MariaDB-client.

[root@dbs ~]# yum install MariaDB-server MariaDB-client -y

[root@dbs ~]# rpm -qa MariaDB*
MariaDB-client-5.5.29-1.i686
MariaDB-server-5.5.29-1.i686
MariaDB-compat-5.5.29-1.i686
MariaDB-common-5.5.29-1.i686
[root@dbs ~]#

4. Nah, jika kita memakai MySQL-Server, daemonnya bernama ‘mysqld’, tapi untuk MariaDB nama service daemonnya adalah ‘mysql’. Sekarang jalankan service MariaDB.

# Memulai service MariaDB
[root@dbs ~]# service mysql start
Starting MySQL....[ OK ]

# MariaDB juga masih menggunakan port yg sama dengan MySQL
[root@dbs ~]# netstat -tunpl | grep mysql
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1987/mysqld

5. Setelah itu, kita perlu memberikan password kepada user ‘root’.

# Set password user 'root'
[root@dbs ~]# mysqladmin -u root password 'MariadbRootpass'

# Login ke shell MariaDB
[root@dbs ~]# mysql -u root -p
Enter password:

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.29-MariaDB MariaDB Server

Copyright (c) 2000, 2012, Oracle, Monty Program Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

# Syntax perintah MariaDB pun sama persis dengan MySQL.
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

MariaDB [(none)]>

6. Kita akan coba membuat database ‘mariaDB’ dengan user ‘mariaDBuser’.

# Membuat database "mariaDB".
MariaDB [(none)]> create database mariaDB;
Query OK, 1 row affected (0.00 sec)</code>

# Membuat user "mariaDBuser" dengan password "mariaDBpass".
MariaDB [(none)]> create user 'mariaDBuser'@'localhost' identified by 'mariaDBpass';
Query OK, 0 rows affected (0.00 sec)

# Memberikan semua hak akses di database "mariaDB" kepada user "mariaDBuser".
MariaDB [(none)]> grant all privileges on mariaDB.* to 'mariaDBuser'@'localhost';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mariaDB            |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.00 sec)

MariaDB [(none)]>

7. Yang saya suka adalah, di shell prompt MariaDB terdapat info nama database yg sedang kita pakai, jika kita tidak menggunakan database, maka akan di tampilkan “[none]“.

# Menggunakan database mysql.
MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A</code>

Database changed

# dan nama database pun tampil di prompt shell. :)
MariaDB [mysql]&gt; select user,password,host from user;
+--------+-------------------------------------------+-----------+
| user   |                    password               |    host   |
+--------+-------------------------------------------+-----------+
| root   | *1F97D2C878F0792D26BB3FEA50B832499A1A0302 | localhost |
| root   |                                           |    dbs    |
| root   |                                           | 127.0.0.1 |
| root   |                                           |    ::1    |
|        |                                           |    dbs    |
| mariaDBuser | *3CE8BC87B8482D802ADF1761069593644   | localhost |
+-------------+--------------------------------------+-----------+
7 rows in set (0.00 sec)

MariaDB [mysql]> \q
Bye
[root@dbs ~]#

Ternyata, setelah kita tahu caranya, tidak sulit amat bukan? :). Selesai.

About these ads
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: