yum 安装percona mysql 5.7
Mysql5.7安装准备
1.基础信息:
(1)可参考官方文档【https://www.percona.com/doc/percona-server/5.7/installation/yum_repo.html】
(2)环境信息
系统:Centos7.3
Mysql:Percona的Mysql5.7
2.安装方式:
这里选择yum安装,原因是没有特殊需求,yum安装比较快
部署Mysql5.7
1.关闭selinux及firewalld防火墙
如果不关闭,启动会受到影响!!!别问我为什么知道!!!
# sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux
# setenforce 0 #关闭Selinux(强烈建议关闭)
# systemctl stop firewalld
# systemctl disable firewalld #关闭firewalld防火墙
2.安装yum源
# yum -y install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm
3.安装Percona-server57(mysql5.7)
# yum -y install Percona-Server-server-57
4.创建mysql相关目录
# mkdir -p /opt/mysql/{mysql_data,mysql_log} #创建mysql的数据目录和日志目录
# chown -R mysql:mysql /opt/mysql #更改属主属组为mysql
# usermod -d /opt/mysql mysql #将mysql用户的家目录改成工作目录(个人觉得应该修改)
修改配置文件
(1)清理不必要的原生配置文件
# cd /etc/
# rm -rf my.cnf my.cnf.d percona-server.cnf percona-server.conf.d #我觉得这么一堆配置文件,不好维护,所以全部干掉
(2)建立mysql配置文件
cat <<EOF>>/etc/my.cnf
# Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208 [client]
port = 3306
socket = /tmp/mysql.sock [mysql] # CLIENT #
port = 3306
socket = /tmp/mysql.sock
default-character-set = utf8
prompt="\u@\h:\p \R:\m:\s [\d]>" [mysqld] # GENERAL #
user = mysql
default-storage-engine = InnoDB
character_set_server = utf8
socket = /tmp/mysql.sock
pid-file = /opt/mysql/mysql_log/mysqld.pid
log_timestamps = SYSTEM
server-id = 1001 # MyISAM #
key-buffer-size = 32M
myisam-recover-options = FORCE,BACKUP # SAFETY #
max-allowed-packet = 32M
max-connect-errors = 1000000
sql-mode = NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
innodb = FORCE # DATA STORAGE #
datadir = /opt/mysql/mysql_data/ # BINARY LOGGING #
log-bin = /opt/mysql/mysql_log/mysql-bin
expire-logs-days = 15
sync-binlog = 1
binlog_format = ROW
log_bin_trust_function_creators = ON
binlog_rows_query_log_events = ON # REPLICATION #
gtid_mode = ON
enforce_gtid_consistency = ON
log_slave_updates = ON
relay-log = /opt/mysql/mysql_log/relay-bin
relay_log_info_repository = TABLE
relay_log_recovery = ON
sync-relay-log = 10000
sync-relay-log-info = 10000
master_info_repository = TABLE
sync-master-info = 10000
binlog_group_commit_sync_delay = 0
binlog_group_commit_sync_no_delay_count = 0
transaction_write_set_extraction = 'XXHASH64'
binlog_transaction_dependency_tracking = WRITESET # SLAVE #
slave-parallel-type = LOGICAL_CLOCK
slave-parallel-workers = 8
#read-only = 1
#super_read_only = 1
slave-net-timeout = 60
#skip-slave-start = 1
slave_pending_jobs_size_max = 64M # CACHES AND LIMITS #
tmp-table-size = 32M
max-heap-table-size = 32M
query-cache-type = 0
query-cache-size = 0
max-connections = 8000
thread-cache-size = 50
open-files-limit = 65535
table-definition-cache = 4096
table-open-cache = 4096
optimizer_switch = 'condition_fanout_filter=off,derived_merge=off' # INNODB #
innodb-flush-method = O_DIRECT
innodb-log-files-in-group = 4
innodb-log-file-size = 512M
innodb-flush-log-at-trx-commit = 1
innodb-file-per-table = 1
innodb_log_buffer_size = 8M
innodb-buffer-pool-size = 16G # LOGGING #
log-error = /opt/mysql/mysql_log/mysql-error.log
log_error_verbosity = 1
slow-query-log = 1
slow-query-log-file = /opt/mysql/mysql_log/mysql-slow.log
max_slowlog_size = 1G
log_queries_not_using_indexes = OFF
EOF 注:这个配置文件仅供参考,可以根据自己需求进行更改,Percona的在线生成配置文件工具【http://tools.percona.com/】
(3)修改/etc/systemd/system/mysql.service
# vim /etc/systemd/system/mysql.service
修改以下行
sed -i 's#/var/run/mysqld/mysqld.pid#/opt/mysql/mysql_log/mysqld.pid#g' /etc/systemd/system/mysql.service
sed -i 's#/var/run/mysqld/mysqld.pid#/opt/mysql/mysql_log/mysqld.pid#g' /usr/lib/systemd/system/mysqld.service
sed -i 's#LimitNOFILE = 5000#LimitNOFILE = 100000#g' /etc/systemd/system/mysql.service
sed -i 's#LimitNOFILE = 5000#LimitNOFILE = 100000#g' /usr/lib/systemd/system/mysqld.service
# systemctl daemon-reload #重新加载配置
4.启动mysql
# systemctl enable mysqld
# systemctl start mysqld
mysql简单初始化
(1)登录及修改初始密码
# grep -i 'password' /opt/mysql/mysql_log/mysql-error.log #获取mysql初始密码
2018-04-19T04:07:12.534522Z 1 [Note] A temporary password is generated for root@localhost: er+Pezm/r31i # mysql -u root -p'er+Pezm/r31i' #登录mysql # SET PASSWORD FOR root@'localhost' = 'MFdb@2018!'; #更改root密码
.简单排错
如果启动时报错,可以使用以下方式排错
(1) 查看当前实例使用的配置文件是否是你定义的
# mysqld --verbose --help |grep -A 1 'Default options'
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
(2)查看输出日志
# cat /opt/mysql_log/mysql-error.log
(3)查看系统日志
# systemctl status mysqld #这个看systemd的报错,个人觉得没什么卵用
# journalctl -b #这个看系统输出的日志,信息量很大,比较有用
# journalctl -xe #这个也是系统输出的日志,信息简略,有一些用
yum 安装percona mysql 5.7的更多相关文章
- 用yum安装完mysql后没有mysqld的问题
在Centos中用命令 yum install mysql安装数据库,但装完后运行mysqld启动mysql的时候提示找不到,通过 find / | grep mysqld 也没找到mysqld的目录 ...
- yum安装Apache,Mysql,PHP
用yum安装Apache,Mysql,PHP. 用yum安装Apache,Mysql,PHP. 2.1安装Apache yum install httpd httpd-devel 安装完成后,用/e ...
- Linux 下 YUM 安装 Percona Server 5.6
Percona Server 是 MySQL 的衍生版,专注于 Linux/BSD 下 MySQL 数据库服务器的改进, 在功能和性能上较 MySQL 有着显著的提升. Percona Server ...
- centos下yum安装crontab+mysql自动备份
参考博文: centos下yum安装crontab yum install vixie-cron crontabs //安装 chkconfig crond on ...
- [转]centos6.5修改yum安装的mysql默认目录
本文转自:https://www.cnblogs.com/fefjay/p/6044444.html 0.说明 Linux下更改yum默认安装的mysql路径datadir.linux下,MySQL默 ...
- centos6.5修改yum安装的mysql默认目录
0.说明 Linux下更改yum默认安装的mysql路径datadir. linux下,MySQL默认的数据文档存储目录为/var/lib/mysql. 假如要把MySQL目录移到/home/data ...
- centos yum 安装php mysql
1 安装php7 查看 centos 版本 # cat /etc/centos-release 删除之前的 php 版本 # yum remove php* php-common rpm 安装 Php ...
- (转) Linux(Centos7)yum安装最新mysql
原文:http://blog.csdn.net/gebitan505/article/details/54613549 环境 CentOS 7.1 (64-bit system) MySQL 5.6. ...
- CentOS通过yum安装MariaDB(MySQL)无法启动服务或者找不到mysql.sock
转载自:http://www.linuxidc.com/Linux/2016-03/129396.htm 今天在Linux主机(CentOS 7)安装(yum install方式)Mariadb(即开 ...
随机推荐
- iOS客户端与网页交互文档
很少和客户端打交道,这次由于做会活动,要和客户端配合做个分享的功能 这里总结下基本的流程,就是前端在H5 里调用客户端的方法即可 第一部分 客户端提供需求文档 网页请求设置 客户端发起请求时在HTTP ...
- RabbitMQ权限
RabbitMQ 引言 RabbitMQ是一个在AMQP基础上完整的,可复用的企业消息系统.他遵循Mozilla Public License开源协议. MQ全称为Message Queue, 消息队 ...
- windows srver 显示桌面图标。
rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0
- ACM-ICPC 2018 沈阳赛区网络预赛 D. Made In Heaven(约束第K短路)
题意:求11到nn的第kk短的路径长度,如果超过TT输出Whitesnake!Whitesnake!,否则输出yareyaredawayareyaredawa. 好无以为 , 这就是一道模板题, 当是 ...
- CMD当前代码页修改
python3.x在程序开发中统一的编码是 UTF-8,但是进行交互式编程的时候会经常遇到乱码问题,这是因为Window cmd的默认编码是GBK.与程序采用的 UTF-8 不一致造成的中文及特殊字符 ...
- ERROR [org.apache.hadoop.util.Shell] - Failed to locate the winutils binary in the hadoop binary path
错误日志如下: -- ::, DEBUG [org.apache.hadoop.metrics2.lib.MutableMetricsFactory] - field org.apache.hadoo ...
- C++中的swap函数
最通用的模板交换函数模式:创建临时对象,调用对象的赋值操作符 template <class T> void swap ( T& a, T& b ) { T c(a); a ...
- mac-profile
Mac 中定义与Linux一样的profile.d 首先Mac是没有profile.d的 在/etc/profile文件中添加 for sh in /etc/profile.d/*sh; do [ - ...
- HDU 5445——Food Problem——————【多重背包】
Food Problem Time Limit: 3000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)To ...
- Java算法面试题 一个顺子带一对
打牌里面经常出现的5张牌,一个顺子带一对,给你五张牌,比如:1,2,2,2,3 或者 5,6,7,4,4 或者 2,4,3,5,5 或者 7,5,9,6,9 ,这种情况就符合一个顺子带一对,则返回 t ...