(..) φ note when MariaDB was installed in the continuation of the last time

# yum -y install mariadb-server ← mariadb-server installation # vi /etc/my.cnf.d/server.cnf ← Edit MariaDB configuration file

What to edit

[mysqld] character-set-server = utf8mb4 ← Add (MariaDB server character code is changed to 4 byte UTF-8 character code set)

Setting automatic startup

# systemctl start mariadb ← Start MariaDB # systemctl enable mariadb ← MariaDB automatic start setting

MariaDB initial settings

# mysql_secure_installation ← MariaDB initial setting NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user.If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.Enter current password for root (enter for none): ← empty ENTER OK , successfully used password, moving on ... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.Set root password? [Y / n] ← Empty ENTER (root password setting) New password: ← Respond any root password Re-enter new password: ← Respond the same password as above (confirmed) Password updated successfully! Reloading privilege tables .. ... Success! log into Mari aDB without having to have a user account created for them.This is intended only for testing, and to make the installation go a bit smoother.You should remove them before moving into a production environment.Remove anonymous users? [Y / n] ← Empty ENTER (remove anonymous user) ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y / n] ← Empty ENTER (Remote root login prohibited) ... Success! By default, MariaDB comes with a database named 'test' that anyone can access.This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y / n] ← Empty ENTER (remove test database)-Dropping test database ... ... Success!-Removing privileges on test database ... ... Success! Reloading the privilege tables will ensure that all changes made so far will take eff ect immediately.Reload privilege tables now? [Y / n] ← empty ENTER ... Success! Cleaning up ... All done! If you've completed all of the above steps, your MariaDB installation should now be secure.Thanks for using MariaDB!

Continue setting up the DB

# mysql -u root -p ← Log in to MariaDB as root Enter password: ← MariaDB root password response Welcome to the MariaDB monitor.Commands end with; or \ g. Your MariaDB connection id is 12 Server version: 5.5.37-MariaDB MariaDB Server Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others. Type 'help;' or '\ h' for help. Type '\ c' to clear the current input statement. MariaDB [(none)]> grant all privileges on test. * to centos @ localhost identified by 'centospass'; ← Register a new user centos with all access rights to the test database Query OK, 0 rows affected (0.00 sec) MariaDB [(none) ]> select user from mysql.user where user = 'centos'; ← centos user registration confirmation + -------- + | user | + -------- + | centos | + --- ----- + 1 row in set (0.00 sec) MariaDB [(none)]> exit ← Logout Bye # mysql -u centos -pcentospass ← Log in to MariaDB as a centos user Welcome to the MariaDB monitor. Commands end with; or \ g. Your MariaDB connection id is 13 Server version: 5.5.37-MariaDB MariaDB Server Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others. Type 'help;' or '\ h' for help.Type '\ c' to clear the current input statement. MariaDB [(none)]> create database test; ← test database creation Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> show databases; ← database creation confirmation + ---- ---------------- + | Database | + -------------------- + | information_schema | | test | +- ------------------- + 2 rows in set (0.00 sec) MariaDB [(none)]> use test; ← Connect to test database Database changed MariaDB [test]> create table test (num int, name varchar (50)); ← Create test table Query OK, 0 rows affected (0.09 sec) MariaDB [test]> show tables; ← Confirm table creation + --------- ------- + | Tables_in_test | + ---------------- + | test | + ---------------- + 1 row in set (0.00 sec) MariaDB [test]> insert into test values (1, 'Taro Yamada'); ← Data to test table Record Query OK, 1 row affected, 1 warning (0.01 sec) MariaDB [test]> select * from test; ← Data registration confirmation + ------ + -------------- + | num | name | + ------ + -------------- + | 1 | Taro Yamada | + ------ + ------- ------- + 1 row in set (0.00 sec) MariaDB [test]> update test set name = 'Jiro Yamada'; ← Update data in test table Query OK, 1 row affected (0.03 sec) Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [test]> select * from test; ← Data update confirmation + ------ + -------------- + | num | name | + ------ + -------------- ++ | 1 | Jiro Yamada | + ------ + -------------- + 1 row in set (0.00 sec) MariaDB [test]> delete from test where num = 1; ← Delete data in test table Query OK, 1 row affected (0.03 sec) MariaDB [test]> select * from test; ← Data Confirm empty deletion (0.00 sec) MariaDB [test]> drop table test; ← delete test table Query OK, 0 rows affected (0.02 sec) MariaDB [test]> show tables; ← Confirm delete table Empty set (0.00 sec) MariaDB [test ]> drop database test; ← Delete database test Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> show databases; ← Confirm database deletion + --------------- ----- + | Database | + -------------------- + | information_schema | + --------------- ----- + 1 row in set (0.01 sec) MariaDB [(none)]> exit ← logout Bye # mysql -u root -p ← Log in to MariaDB as root Enter password: ← MariaDB root password response Welcome to the MariaDB monitor. Commands end with; or \ g. Your MariaDB connection id is 4 Server version: 5.5.37-MariaDB MariaDB Server Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others. Type 'help;' or ' \ h 'for help. Type' \ c 'to clear the current input statement. MariaDB [(none)]> revoke all privileges on *. * from centos @ localhost; ← Revoke centos user access to all databases Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> delete from mysql.user where user = 'centos' and host =' localho st '; ← Delete centos user Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> select user from mysql.user where user =' centos'; ← Confirm centos user deletion Empty set (0.00 sec) MariaDB [ (none)]> flush privileges; ← Reflect removal of centos user to MariaDB server Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> exit ← Logout Bye

that's all! ! !