CentOS 7.0 uses Yum to install MariaDB and MariaDB simple configuration

Source: Internet
Author: User
Tags anonymous

1, installation mariadb

Installation commands

Yum-y Install mariadb Mariadb-server

Installation Complete mariadb, first start mariadb

Systemctl Start mariadb

Set boot up

Systemctl Enable MARIADB

The following is a simple configuration of mariadb

Mysql_secure_installation

The first is to set the password, you will be prompted to enter the password

Enter current password to root (enter for none): <– First run direct carriage return

Set Password

Set root Password? [y/n] <– whether to set the root user password, enter Y and return or direct enter
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] <– Whether to delete anonymous users, enter

Disallow Root login remotely? [y/n] <– Whether root login is forbidden, enter,

Remove test database and access to it? [y/n] <– Whether to delete the test database, enter

Reload privilege tables now? [y/n] <– whether to reload the permissions table, enter

Initialize MARIADB complete, next Test login

Mysql-uroot-ppassword

Complete.

2. Configuring the MARIADB Character Set

File/etc/my.cnf

Vi/etc/my.cnf

Add under the [Mysqld] tab

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 configuration, restart MARIADB

Systemctl Restart MARIADB

Then enter MARIADB to view the character set

Mysql> Show variables like "%character%", show variables like "%collation%";

Displayed 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)

The character set configuration is complete.

3. Add users, set permissions

Create user command

mysql>create user [email protected] identified by ' password ';

Direct creation of user and authorized commands

Mysql>grant all on * * to [e-mail protected] indentified by ' password ';

Grant access to the extranet

Mysql>grant all privileges on * * to [e-mail protected] '% ' identified by ' password ';

Grant permissions and can authorize

Mysql>grant all privileges on * * to [e-mail protected] ' hostname ' identified by ' password ' with GRANT option;
Mysql>flush privileges;

CentOS 7.0 uses Yum to install MariaDB and MariaDB simple configuration

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.