12.11.2013

Install and Configure MariaDB on CentOS 6

1. Go to repository generator, select the desired repository. In my case, I got this:
# MariaDB 5.5 CentOS repository list - created 2013-12-07 02:35 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
2. Create a new repo, and put the generated text above.
$ sudo vi /etc/yum.repos.d/MariaDB.repo
3. Install
$ sudo yum install MariaDB-server MariaDB-client MariaDB-devel MariaDB-common
4. Start mysql
$ sudo /etc/init.d/mysql start
$ sudo /sbin/chkconfig mysql on
5. Autostart mysql
Find out the name of service’s script from /etc/init.d/ directory e.g. mysqld or httpd
Add it to chkconfig
$ sudo /sbin/chkconfig --add mysqld
Make sure it is in the chkconfig.
$ sudo /sbin/chkconfig --list mysqld
Set it to autostart
$ sudo /sbin/chkconfig mysqld on
6. Setup mysql Login as root:
[samdc@perfdb4 apps]$ mysql -u root
Set root password:
MariaDB [(none)]> set password for root@localhost=password('mypass');
MariaDB [(none)]> set password for root@'127.0.0.1'=password('mypass');
MariaDB [(none)]> set password for root@'machine.domain.com'=password('mypass');
Delete anonymous:
MariaDB [(none)]> delete from mysql.user where user='';
7. Create db and user: Create db:
MariaDB [(none)]> create database mydb;
Create user myuser with password mypass:
MariaDB [(none)]> grant all on mydb.* to 'mydb' identified by 'mypass';
MariaDB [(none)]> grant all on mydb.* to 'mydb'@'localhost' identified by 'mypass';
8. Show databases
MariaDB [(none)]> show databases;

No comments:

Post a Comment