Centos6 通过RPM部署Mysql5.7
2017-08-15 11:17
411 查看
1.下载对应版本的mysql
rpm安装包
本人用的是centos6.8 64位系统,mysql安装包官方下载地址
2.安装mysql5.7
yum list installed | grep mysql 查看是否有安装过mysql 通过yum remove 卸载
rpm -qa | grep -i mysql 查看是否有rpm包 通过rpm -e --nodeps移除
②. 安装依赖(Mysql5.7 需要安装)
③.安装mysql rpm包
只需要安装其中的四个
④.修改mysql配置文件my.cnf
⑤.启动mysql并查看mysql初始化的随机密码
service mysqld start
grep 'temporary password' /var/log/mysqld.log
⑥.修改初始密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new
password';
需要注意是的 5.7中 设置的密码安全度有点高,需要有大小写字母数字特殊字符,可以更改后,再去my.cnf中加入validate_password=OFF 去除密码安全度验证。
最后附上 自用的生产环境Mysql配置(部分配置用于主从同步可以忽略,具体参数根据服务器配置设置)
[client]
port= 3306
socket= /tmp/mysql.sock
[mysqld]
basedir=/usr
datadir=/data/mysql
port=3306
socket=/tmp/mysql.sock
character-set-server = utf8mb4
default-storage-engine = InnoDB
symbolic-links=0
skip-name-resolve = 1
open_files_limit = 65535
back_log = 384
max_connections = 5000
max_connect_errors = 100000
table_open_cache = 2048
tmp-table-size = 32M
max-heap-table-size = 32M
#query-cache-type = 0
query-cache-size = 0
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 51
query_cache_size = 32M
tmp_table_size = 512M
max_heap_table_size = 96M
query_cache_type=1
log-error=/data/logs/mysqld.log
slow_query_log = 1
slow_query_log_file = /data/logs/slow.log
long_query_time = 0.1
# BINARY LOGGING #
server-id = 1
log-bin = /data/binlog/mysql-bin
log-bin-index =/data/binlog/mysql-bin.index
expire-logs-days = 14
sync_binlog = 1
binlog_cache_size = 2048M
max_binlog_cache_size = 4096M
max_binlog_size = 1024M
log_slave_updates
#binlog_format = row
binlog_format = MIXED
relay_log_recovery = 1
pid-file=/data/mysql/mysqld.pid
#不需要同步的表
#replicate-wild-ignore-table=mydb.sp_counter
#不需要同步的库
replicate-ignore-db = mysql,information_schema,performance_schema,sys
key_buffer_size = 768M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover_options=force,backup
transaction_isolation = REPEATABLE-READ
#innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 18G
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_data_file_path = ibdata1:1024M:autoextend
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 128M
innodb_log_file_size = 2G
innodb_log_files_in_group = 2
innodb_io_capacity = 4000
innodb_io_capacity_max = 8000
innodb_max_dirty_pages_pct = 50
innodb_flush_method = O_DIRECT
innodb_file_format = Barracuda
innodb_file_format_max = Barracuda
innodb_lock_wait_timeout = 10
innodb_rollback_on_timeout = 1
innodb_print_all_deadlocks = 1
innodb_file_per_table = 1
innodb_locks_unsafe_for_binlog = 0
lower_case_table_names=1
validate_password=OFF
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
## Thread settings
#thread_concurrency=24
#thread_cache_size=250
[mysqldump]
quick
max_allowed_packet = 128M
rpm安装包
本人用的是centos6.8 64位系统,mysql安装包官方下载地址
2.安装mysql5.7
安装步骤如下
①.查看系统已经安装过其他版本的mysqlyum list installed | grep mysql 查看是否有安装过mysql 通过yum remove 卸载
rpm -qa | grep -i mysql 查看是否有rpm包 通过rpm -e --nodeps移除
②. 安装依赖(Mysql5.7 需要安装)
yum -y install numactl
③.安装mysql rpm包
只需要安装其中的四个
rpm -ivh mysql-community-common-5.7.19-1.el6.x86_64.rpm rpm -ivh mysql-community-libs-5.7.19-1.el6.x86_64.rpm rpm -ivh mysql-community-client-5.7.19-1.el6.x86_64.rpm rpm -ivh mysql-community-server-5.7.19-1.el6.x86_64.rpm
④.修改mysql配置文件my.cnf
[client] default-character-set=utf8 [mysqld] character_set_server=utf8
⑤.启动mysql并查看mysql初始化的随机密码
service mysqld start
grep 'temporary password' /var/log/mysqld.log
⑥.修改初始密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new
password';
需要注意是的 5.7中 设置的密码安全度有点高,需要有大小写字母数字特殊字符,可以更改后,再去my.cnf中加入validate_password=OFF 去除密码安全度验证。
最后附上 自用的生产环境Mysql配置(部分配置用于主从同步可以忽略,具体参数根据服务器配置设置)
[client]
port= 3306
socket= /tmp/mysql.sock
[mysqld]
basedir=/usr
datadir=/data/mysql
port=3306
socket=/tmp/mysql.sock
character-set-server = utf8mb4
default-storage-engine = InnoDB
symbolic-links=0
skip-name-resolve = 1
open_files_limit = 65535
back_log = 384
max_connections = 5000
max_connect_errors = 100000
table_open_cache = 2048
tmp-table-size = 32M
max-heap-table-size = 32M
#query-cache-type = 0
query-cache-size = 0
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 51
query_cache_size = 32M
tmp_table_size = 512M
max_heap_table_size = 96M
query_cache_type=1
log-error=/data/logs/mysqld.log
slow_query_log = 1
slow_query_log_file = /data/logs/slow.log
long_query_time = 0.1
# BINARY LOGGING #
server-id = 1
log-bin = /data/binlog/mysql-bin
log-bin-index =/data/binlog/mysql-bin.index
expire-logs-days = 14
sync_binlog = 1
binlog_cache_size = 2048M
max_binlog_cache_size = 4096M
max_binlog_size = 1024M
log_slave_updates
#binlog_format = row
binlog_format = MIXED
relay_log_recovery = 1
pid-file=/data/mysql/mysqld.pid
#不需要同步的表
#replicate-wild-ignore-table=mydb.sp_counter
#不需要同步的库
replicate-ignore-db = mysql,information_schema,performance_schema,sys
key_buffer_size = 768M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover_options=force,backup
transaction_isolation = REPEATABLE-READ
#innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 18G
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_data_file_path = ibdata1:1024M:autoextend
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 128M
innodb_log_file_size = 2G
innodb_log_files_in_group = 2
innodb_io_capacity = 4000
innodb_io_capacity_max = 8000
innodb_max_dirty_pages_pct = 50
innodb_flush_method = O_DIRECT
innodb_file_format = Barracuda
innodb_file_format_max = Barracuda
innodb_lock_wait_timeout = 10
innodb_rollback_on_timeout = 1
innodb_print_all_deadlocks = 1
innodb_file_per_table = 1
innodb_locks_unsafe_for_binlog = 0
lower_case_table_names=1
validate_password=OFF
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
## Thread settings
#thread_concurrency=24
#thread_cache_size=250
[mysqldump]
quick
max_allowed_packet = 128M
相关文章推荐
- CentOS 7.0 通过rpm包安装安装mysql 5.7
- 阿里云ECS安装MySQL通过yum安装,rpm源码安装,navicat for mysql 无法远程连接解决办法 包括Tomcat,Nginx无法远程访问等
- 【装载】MySQL通过RPM安装
- 通过rpm 安装MYSQL
- CentOS6或CentOS7下通过yum安装mysql
- docker部署mysql5.7
- 【MySQL】Linux下MySQL 5.5、5.6和5.7的RPM、二进制和源码安装
- MySQL 5.6.38在RedHat 6.5上通过RPM包安装
- 通过rpm包安装、配置及卸载mysql
- SUSE Linux下通过RPM方式卸载MySQL 5过程笔记
- 基于centos6的mysql5.7.13主从部署(三)
- mysql 5.7快速部署
- Centos7 下 mysql 5.7通过 amoeba 读写分离
- (三)lamp(httpd+php(php为module或是FastCGI)+mysql)centos6(rpm包)
- MySQL5.6.12 rpm制作及及自动化部署安装
- RHEL5.7上MySQL-Cluster-7.2.13双机集群安装部署手册
- 通过rpm包安装、配置及卸载mysql的详细过程
- Mysql5.7源码单实例部署
- MySQL 5.7 多实例安装部署实例
- 远程Linux上部署Mysql5.7