Long-standing space environment configuration forget almost, today Hollow finishing, reset the disk to rebuild the environment, first install the MARIADB database, here to record the installation process for later review.
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
like "% character% 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>createuser username@localhostby'password ';
Direct creation of user and authorized commands
MySQL>Grantall on*. * to username@localhostby'password';
Grant access to the extranet
MySQL>Grantallprivilegeson*. * to [Email protected] ' % ' by ' Password ';
Grant permissions and can authorize
MySQL>Grantallprivilegeson*. * to [Email protected] ' hostname ' by ' Password ' with Grant option;
Simple user and permission configuration is basically the case.
Where 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.
CentOS 7.0 uses Yum to install a simple configuration of MariaDB and MariaDB