Various settings after Mariadb installation

1. Install MariaDB

Installation Command

yum -y install mariadb mariadb-server

Once the installation is complete, start MariaDB first. Both commands will work

systemctl start mariadb

perhaps

service mariadb start

Set up boot-up

systemctl enable mariadb

Or:

chkconfig mariadb on

2. Next, make a simple configuration of MariaDB

mysql_secure_installation

First, set the password, you will be prompted to enter the password first

Enter current password for root (enter for none): < - Enter directly on first run

Set Password

Set root password? [Y/n] < - Do you want to set the root user password, enter y and return or return directly
 New password: <- Set the root user's password
 Re-enter new password: <-Enter the password you set again

Other Configurations

Remove anonymous users? [Y/n] < - Delete anonymous users and return

Disallow root login remotely? [Y/n] < - Do you want to disable root remote login and return?

Remove test database and access to it? [Y/n] < - Delete test database, return

Reload privilege tables now? [Y/n] < - Do you want to reload the permission table and return

Initialize MariaDB complete, then test login

mysql -uroot -ppassword

Complete.

3. Configure the character set for MariaDB

File/etc/my.cnf

vi /etc/my.cnf

Add under [mysqld] tag

init_connect='SET collation_connection = utf8_unicode_ci' 
init_connect='SET NAMES utf8' 
character-set-server=utf8 
collation-server=utf8_unicode_ci 
skip-character-set-client-handshake

File/etc/my.cnf.d/client.cnf

vi /etc/my.cnf.d/client.cnf

Add in [client]

default-character-set=utf8

File/etc/my.cnf.d/mysql-clients.cnf

vi /etc/my.cnf.d/mysql-clients.cnf

Add in [mysql]

default-character-set=utf8

Complete all configuration, restart mariadb

systemctl restart mariadb

Then enter MariaDB to view the character set

mysql> show variables like "%character%";show variables like "%collation%";

Show as

+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client    | utf8                      |
| character_set_connection | utf8                      |
| character_set_database  | utf8                      |
| character_set_filesystem | binary                    |
| character_set_results    | utf8                      |
| character_set_server    | utf8                      |
| character_set_system    | utf8                      |
| character_sets_dir      | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

+----------------------+-----------------+
| Variable_name        | Value          |
+----------------------+-----------------+
| collation_connection | utf8_unicode_ci |
| collation_database  | utf8_unicode_ci |
| collation_server    | utf8_unicode_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)

Character set configuration complete.

4. Add users and set permissions

Create User Command

mysql>create user username@localhost identified by 'password';

Commands that create users directly and authorize them

mysql>grant all on *.* to username@localhost indentified by 'password';

Grant login rights to foreign websites, but not secondary authorization;

mysql>grant all privileges on *.* to username@'%' identified by 'password';

Grant permissions and can be authorized twice

mysql>grant all privileges on *.* to username@'hostname' identified by 'password' with grant option;

Simple user and permission configurations are basically there.
Only partial permissions are granted to change all privileges or all to:
select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file
Part of it.

Linux System Tutorial: How to check MariaDB server-side version http://www.linuxidc.com/Linux/2015-08/122382.htm

Implementation of read-write separation for MariaDB Proxy http://www.linuxidc.com/Linux/2014-05/101306.htm

Compiling and installing methods for configuring MariaDB databases on Linux http://www.linuxidc.com/Linux/2014-11/109049.htm

CentOS system uses yum to install MariaDB database http://www.linuxidc.com/Linux/2014-11/109048.htm

Install MariaDB with MySQL http://www.linuxidc.com/Linux/2014-11/109047.htm

How to migrate MySQL 5.5 database to MariaDB 10 on Ubuntu http://www.linuxidc.com/Linux/2014-11/109471.htm

Ubuntu 14.04 (Trusty) Server Install MariaDB http://www.linuxidc.com/Linux/2014-12/110048htm

MariaDB details: http://www.linuxidc.com/Linux/2012-03/56857.htm
MariaDB download address: http://www.linuxidc.com/down.aspx?id=363

Keywords: MariaDB MySQL Linux Database

Added by activeserver on Thu, 20 Jun 2019 21:03:02 +0300