CentOS7 under MariaDB database installation and configuration

Foreword

MariaDB MySQL database management system is a branch, mainly by the open source community in the maintenance, the purpose of using GPL licensed MariaDB is fully compatible with MySQL, including API and command line, so that it can easily become a substitute for MySQL. In terms of storage engine, use XtraDB instead of MySQL InnoDB. Developed by leading MariaDB MySQL founder Michael Widenius, MariaDB Michael Widenius name comes from the name of his daughter Maria

Linux install MariaDB

installation

Using yum install MariaDB

yum install mariadb*

figure 1
Installation MariaDB, first start MariaDB

systemctl start mariadb

Set boot

systemctl enable mariadb

Next related simple configuration of MariaDB

mysql_secure_installation

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

Enter current password for root (enter for none):        #–初次运行直接回车

set password

Set root password? [Y/n]           # – 是否设置root用户密码,输入y并回车或直接回车

New password:                      # – 输入root用户的密码

Re-enter new password:             # – 再输入一次你设置的密码

Other configurations

Remove anonymous users? [Y/n]                  # – 是否删除匿名用户,回车

Disallow root login remotely? [Y/n]            # –是否禁止root远程登录,回车

Remove test database and access to it? [Y/n]   # – 是否删除test数据库,回车

Reload privilege tables now? [Y/n]             # – 是否重新加载权限表,回车

MariaDB initialization is complete, the next test Login

mysql -u root -p 
Enter password:

Configuration

MariaDB character set configuration files/etc/my.cnf

vi /etc/my.cnf

In [mysqld]add under the label

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

In [client]the Add

default-character-set=utf8

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

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

In [mysql]the Add

default-character-set=utf8

All configuration is complete, restart mariadb

systemctl restart mariadb

After entering MariaDB view the character set

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

shown 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 is complete.

Add users, set permissions

Create a user command

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

Direct command to create user and authorization

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

Granted landing rights outside the network

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

Permission and authorization can be granted

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

Simple user configuration and basic rights on the case.

Which granted permission to only part of which all privilegesor allchange select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,filepart of it.

reference

Linux System Tutorial: How to Check MariaDB server versions http://www.linuxidc.com/Linux/2015-08/122382.htm

MariaDB Proxy separate read and write to achieve http://www.linuxidc.com/Linux/2014-05/101306.htm

Linux compiler installation method to configure MariaDB database http://www.linuxidc.com/Linux/2014-11/109049.htm

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

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

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

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

Guess you like

Origin www.cnblogs.com/WindSun/p/12142647.html