How To Install MySQL / MariaDB on CentOS 7


MariaDB is a drop-in replacement for MySQL. It is easy to install, offers many speed and performance improvements, and is easy to integrate into most MySQL deployments.

MariaDB offers more storage engines than MySQL, including Cassandra (NoSQL, in MariaDB Version 10), XtraDB (drop-in replacement for InnoDB), and OQGRAPH (in MariaDB Version 10).


Install MySQL / MariaDB :

# yum -y install mariadb-server mariadb

Start MariaDB:

# systemctl start mariadb

Starts MySQL/MariaDB at boot:

# systemctl enable mariadb

To check the status

# systemctl status mariadb


Harden MySQL / MariaDB Server :

# mysql_secure_installation

You will be given the choice to change the MariaDB root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases. Do Yes !

Create a New MariaDB User and Database :

create database testdb;

create user 'testuser'@localhost identified by 'password';

grant all on testdb.* to 'testuser' identified by 'password';

You can shorten this process by creating the user while assigning database permissions:

create database testdb;

grant all on testdb.* to 'testuser' identified by 'password';


Reset the MySQL / MariaDB Root Password :

# systemctl stop mariadb

# mysqld_safe --skip-grant-tables &

# mysql -u root

use mysql;

update user SET PASSWORD=PASSWORD("password") WHERE USER='root';

flush privileges;

exit

Start the service and verify

# systemctl start mariadb

How To Install MySQL / MariaDB on CentOS 7 How To Install MySQL / MariaDB on CentOS 7 Reviewed by vivek sathisan on 16:01 Rating: 5

No comments:

© Copyright to vivek sathisan. Powered by Blogger.