实验环境: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