# 安装镜像源yumlocalinstall https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm# 安装mysqlyuminstall mysql-community-server# 配置大小写不敏感vim/etc/my.cnflower_case_table_names=1# 启动systemctlstart mysqldsystemctlenable mysqldgrep'temporary password' /var/log/mysqld.log# 修改密码ALTERUSER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourPassword';FLUSHPRIVILEGES;# 配置远程访问updateuser set host='%' where user='root';flushprivileges;# mysqldump备份用户授权createuser dumper@'%' identified by 'Dumper@123';grantselect on *.* to dumper@'%';grantshow view on *.* to dumper@'%';grantlock tables on *.* to dumper@'%';granttrigger on *.* to dumper@'%';grantprocess on *.* to dumper@'%';grantevent on *.* to dumper@'%';grantreload on *.* to dumper@'%';grantreplication client on *.* to dumper@'%';# logbin及慢日志配置showvariables like 'log%bin%';showvariables like 'binlog_format';showvariables like '%expire%';showvariables like 'slow_query%';showvariables like 'long_query_time';# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.socksymbolic-links=0log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pidsql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';server-id=100log-bin=/var/lib/mysql/binlog.logexpire-logs-days=7slow_query_log=ONslow_query_log_file=/var/lib/mysql/localhost-slow.loglong_query_time=1
[mysqldump]
quick
max_allowed_packet=128Muser=dumperpassword=Dumper@123# 创建用户及数据库createdatabase safept default character set utf8mb4 collate utf8mb4_unicode_ci;createuser 'safept'@'%' identified by 'Safept@123';grantall privileges on safept.* to 'safept'@'%' with grant option;flushprivileges;