實驗環境:CentOS7
#安裝mariadb-server包
#修改mariadb配置文件/etc/my.cnf.d/server.cnf
#添加 skip_name_resolve=ON #不執行將IP解析成主機名
#添加 innodb_file_per_table=ON #每個innodb表單獨的表空間
[root@~ localhost]#yum -y install mariadb-server [root@~ localhost]#vi /etc/my.cnf.d/server.cnf # # These groups are read by MariaDB server. # Use it for options that only the server (but not clients) should see # # See the examples of server my.cnf files in /usr/share/mysql/ # # this is read by the standalone daemon and embedded servers [server] # this is only for the mysqld standalone daemon [mysqld] skip_name_resolve=ON innodb_file_per_table=ON
log_bin=mysql-bin #二進制日志
#查看服務的狀態,mariadb.service監聽端口3306
[root@~ localhost]#systemctl status mariadb.service ● mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled) Active: active (running) since 星期六 2017-06-03 08:19:01 CST; 2h 1min ago [root@~ localhost]#ss -ntl|grep "3306" LISTEN 0 50 *:3306 *:*
首次安裝完成mariadb-server包后,啟動mariadb.service,必須加固數據庫,執行
[root@~ localhost]#mysql_secure_installation
