CentOS 7.0 use yum to install simple configuration of MariaDB and MariaDB

Source: Internet
Author: User

CentOS 7.0 use yum to install simple configuration of MariaDB and MariaDB

I forgot about the environment configuration of the space that has been idle for a long time. I have to leave it empty today and reset the disk to re-build the environment. First, install the MariaDB database in CentOS 7.0, and record the installation process here, for later viewing.

1. Install MariaDB

Installation command

yum -y install mariadb mariadb-server

After MariaDB is installed, start MariaDB.

systemctl start mariadb

Set startup

systemctl enable mariadb

Next, configure MariaDB.

mysql_secure_installation

First, set the password. A prompt is displayed, indicating that the password is entered first.

Enter current password for root (enter for none): <-press Enter directly for the first time

Set Password

Set root password? [Y/n] <-whether to set the root user password. Enter y and press ENTER or press Enter.
New password: <-set the password of the root user
Re-enter new password: <-enter your password again

Other configurations

Remove anonymous users? [Y/n] <-whether to delete anonymous users, press ENTER

Disallow root login remotely? [Y/n] <-whether to disable remote root logon. Press enter,

Remove test database and access to it? [Y/n] <-whether to delete the test database. Press enter.

Reload privilege tables now? [Y/n] <-whether to reload the permission table. Press enter.

MariaDB Initialization is complete. Next, test logon.

mysql -uroot -ppassword

Complete.

 

2. Configure the MariaDB Character Set

File/etc/my. cnf

vi /etc/my.cnf

Add under the [mysqld] 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

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

All configurations are complete. Restart mariadb.

systemctl restart mariadb

Then enter MariaDB to view the character set

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

Displayed


+ -------------------------- + ---------------------------- +
| 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.

 

3. Add users and Set permissions

Create USER commands

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

Directly create user and authorize commands

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

Grant Internet login permission

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

Grant permissions and grant permissions

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

This is basically the case for simple user and permission configuration.

Only some permissions are granted to change all privileges or all to select, insert, update, delete, create, drop, index, alter, grant, references, reload, shutdown, process, file.

Linux Tutorial: How to check the MariaDB server version

Implementation of MariaDB Proxy read/write splitting

How to compile and install the MariaDB database in Linux

Install MariaDB database using yum in CentOS

Install MariaDB and MySQL

How to migrate MySQL 5.5 database to MariaDB 10 on Ubuntu

Install MariaDB on the Ubuntu 14.04 (Trusty) Server

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.