01 mariadb日志文件
CentOS 7编译安装Mariadb
[[email protected] ~]# yum -y groupinstall "Development Tools"
[[email protected] ~]# yum install ncurses-devel openssl-devel libevent-devel jemalloc-devel cmake -y
[[email protected] ~]# tar xf mariadb-5.5.53.tar.gz
[[email protected] ~]# cd mariadb-5.5.53/
[[email protected] mariadb-5.5.53]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb-5.5.53 \
-DMYSQL_DATADIR=/mydata/data \
-DSYSCONFDIR=/etc \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_ZLIB=system \
-DWITH_LIBWRAP=0 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
[[email protected] mariadb-5.5.53]# make && make install
[[email protected] ~]# vim /usr/lib/systemd/system/mariadb.service
# Don‘t forget to reload systemd daemon after you change unit configuration:
# # root> systemctl --system daemon-reload
#
[Unit]
Description=MariaDB database server
After=syslog.target
After=network.target
#
[Service]
Type=simple
User=mysql
Group=mysql
#
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
ExecStart=/usr/local/mysql/bin/mysqld_safe --basedir=/usr/local/mysql
#
# Give a reasonable amount of time for the server to start up /shut down
TimeoutSec=300
#
# Place temp files in a secure directory, not /tmp
PrivateTmp=false
#
[Install]
VantedBy=multi-user.target
[[email protected] mysql]# groupadd -r -g 316 mysql
[[email protected] mysql]# useradd -r -g mysql -u 316 mysql
[[email protected] ~]# systemctl daemon-reload
[[email protected] mariadb-5.5.53]# cp support-files/my-large.cnf /etc/my.cnf
[[email protected] mariadb-5.5.53]# vim /etc/my.cnf
添加
datadir = /data/mysql
[[email protected] mariadb-5.5.53]# cd /usr/local/
[[email protected] local]# ln -s mariadb-5.5.53/ mysql
[[email protected] local]# cd mysql/
[[email protected] mysql]# mkdir /data/mysql -p
[[email protected] mysql]# chown mysql.mysql /data/mysql/
[[email protected] mysql]# chown -R mysql.mysql ./*
[[email protected] mysql]# scripts/mysql_install_db --user=mysql --datadir=/data/mysql
[[email protected] mysql]# systemctl start mariadb.service
#慢查询
MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE ‘long_query_time‘;
+-----------------+-----------+
| Variable_name | Value |
+-----------------+-----------+
| long_query_time | 10.000000 |
+-----------------+-----------+
1 row in set (0.00 sec)
#日志查询
[[email protected] bin]# ./mysqlbinlog --start-position=328 /data/mysql/mysql-bin.000004