1. Install the Package
yum install mariadb mariadb-server -y
2. Edit Vim
/etc/my.cnf.d/mariadb-server.cnf并完成以下操作[mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.socklog-error=/var/log/mariadb/mariadb.logpid-file=/var/run/mariadb/mariadb.pidbind-address = 192.168.10.10default-storage-engine = innodbinnodb_file_per_table = onmax_connections = 4096collation-server = utf8_general_cicharacter-set-server = utf8
3. Set up service boot
systemctl enable mariadb.servicesystemctl start mariadb.service
4. Protect the database service by running the Mysql_secure_installation script.
[[email protected] ~]# mysql_secure_installationnote:running All PARTS of this SCRIPT was RECOMMENDED for all MariaDB SERVERS in PRODUCTION use! Please READ each STEP carefully! In order to log into MariaDB to secure it, we'll need the CurrentPassword for the root user. If you ' ve just installed MariaDB, Andyou Haven ' t set the root password yet, the password would be a blank,so you should just Press ENTER here. Enter current password to root (enter for none): OK, successfully used password, moving on ... Setting The root password ensures that nobody can log into the Mariadbroot user without the proper authorisation. Set root Password? [y/n] ynew password:re-enter new Password:password updated successfully! Reloading privilege tables. ... success! By default, a MariaDB installation had an anonymous user, allowing Anyoneto log into MariaDB without had to had a user Account created Forthem. This was intended only for testing, and the Installationgo a bit smoother. YouShould remove them before moving into aproduction environment. Remove anonymous users? [y/n] Y ... success! Normally, Root should only is allowed to connect from ' localhost '. Thisensures that someone cannot guess at the root of password from the network. Disallow Root login remotely? [y/n] Y ... success! By default, the MariaDB comes with a database named ' Test ' anyone canaccess. This was also intended only for testing, and should was removedbefore moving into a production environment. Remove test database and access to it? [y/n] y-dropping Test Database ... success! -Removing privileges on test database ... success! Reloading the privilege tables would ensure that all changes made so farwill take effect immediately. Reload privilege tables now? [y/n] Y ... success! Cleaning up ... All done! If you've completed all of the above steps, your mariadbinstallation should now is secure. Thanks for using mariadb!
Yum installation mariadb (CentOS7)