1, installation mariadb
Installation commands
Yum-y Install Mariadb-server mariadb-client
Installation Complete mariadb, first start mariadb
Set boot up
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
Complete.
2. Configuring the MARIADB Character Set
File/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;
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 installs MariaDB and simple configuration using Yum