Install Mariadb On Centos Linux
What is
MariaDB ?
MariaDB is an free and open
source database server made by the original developers of MySQL. It is a
drop-in replacement for MySQL.
Install
MariaDB
1. Install MariaDB client and
server
|
yum install mariadb
mariadb-server -y
|
2. Enable and start MariaDB
service
|
systemctl enable mariadb
&& systemctl start mariadb
|
3. Run the setup script,
accepting all defaults. Note: You can
set your database root password during this process.
|
/usr/bin/mysql_secure_installation
|
MariaDB is now installed &
running!
How
to Create a MariaDB user, password and database on CentOS Linux
In this tutorial, we will create a database along with a user to
access the database.
For the purpose of this
tutorial, we will assume that you have already installed MariaDB on CentOS Linux.
1. Log in to the MariaDB
console. If you have a password set, use the -p flag to enter a password.
2. Create a database, named
“testdb” – we will use the utf8mb4 character set (see: “Never use utf8. Use utf8mb4.”)
|
create database testdb CHARACTER SET
utf8mb4 COLLATE utf8mb4_unicode_ci;
|
3. Grant user “testuser”, with
password “testpassword” all access to the “testdb” database. Note: if you want
to remotely access this database, replace ‘localhost’ with your remote address.
grant all privileges on testdb.* to
testuser@'localhost' identified
by 'testpassword';
4. Flush MariaDB privileges
Your database will now be ready
to use!