CentOS 7.0 uses Yum to install MariaDB and MariaDB simple configuration
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 directly enter new password: <– set the root user's password re-enter new password: <– and enter the password you set
Other configurations
Remove anonymous users? [y/n] <– whether to delete anonymous users, enter
"Delete anonymous user This step is very important, may appear, processing inadvertently will appear error: Error 1044 (42000): Access denied for user ' @ ' localhost ' to database ' MySQL ', if the error occurs, Please approach: Resolve Anonymous user issues "
Disallow Root login remotely? [y/n] <– whether root login is forbidden, enter,
Remove test database and access to it? [y/n] <– whether to delete 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= Utf8collation-server=utf8_unicode_ciskip-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.service
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&nbSp | | 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.
To grant only partial permissions, simply change all privileges or all to Select,insert,update,delete,create,drop,index,alter,grant,references,reload, Shutdown,process,file part of it.
[[email protected] ~]# cat/etc/my.cnf# Example MariaDB config file for medium systems.## the is for a system with L Ittle memory (32m-64m) where MariaDB plays# an important part, or systems up to 128M where MariaDB are used together with # Other programs (such as a Web server) # # MariaDB programs look for option files in a set of# locations which depend on th E deployment platform.# You can copy this option file to one of the those# locations. For information on these locations, do:# ' my_print_defaults--help ' and see what's printed under# Default options are Read from the following files on the given order:# more information at:http://dev.mysql.com/doc/mysql/en/option-files.htm l## in this file, you can use the all long options, the a program supports.# If you want to know which options a program Suppo RTS, run the program# with the "--help" option.# the following options would be passed to all MariaDB Clients[client] #passw ord= your_passwordport= 3306socket=/var/lib/mysql/mysql.sockdefault-character-set=utf8# here follows entries for some specific programs# the MariaDB server[mysqld]port= 3306socket=/var /lib/mysql/mysql.sockskip-external-lockingkey_buffer_size = 16mmax_allowed_packet = 1Mtable_open_cache = 64sort_ Buffer_size = 512knet_buffer_length = 8kread_buffer_size = 256kread_rnd_buffer_size = 512kmyisam_sort_buffer_size = 8minit_connect= ' Set collation_connection = Utf8_unicode_ci ' init_connect= ' Set NAMES UTF8 ' character-set-server= utf8collation-server=utf8_unicode_ciskip-character-set-client-handshake# point the following paths to different Dedicated disks#tmpdir=/tmp/# Don ' t listen on a TCP/IP port at all. This can is a security enhancement,# if all processes then need to connect to mysqld run in the same host.# all Interactio N with Mysqld must is made via Unix sockets or named pipes.# Note that using the this option without enabling named Pipes on W indows# (via the "enable-named-pipe" option) would render mysqld useless!# #skip-networking# Replication Master ServeR (default) # Binary logging is required for replicationlog-bin=mysql-bin# binary logging format-mixed recommendedbinlog_ format=mixed# required Unique ID between 1 and 2^32-1# defaults to 1 if Master-host isn't set# but would not function as A master if omittedserver-id= # Replication Slave (Comment out master sections to use this) # to configure this host as a Replication slave, you can choose between# the methods: # 1) Use the Change MASTER to command (fully described in our MA nual)-# The syntax is:## change MASTER to Master_host=[Email protected] ~]# cat/etc/my.cnf.d/client.cnf mysql-clients.cnf server.cnf [[email protected] ~]# CAT/ETC/MY.CNF.D/MYSQL-CLIENTS.CNF # These groups is read by MariaDB command-line tools# with it for options that affect Only one Utility#[mysql]default-character-set=utf8[mysql_upgrade][mysqladmin][mysqlbinlog][mysqlcheck][mysqldump ][MYSQLIMPORT][MYSQLSHOW][MYSQLSLAP]
CentOS 7.0 uses Yum to install MariaDB and MariaDB simple configuration