MySQL 5.7.23 二进制安装

CentOS 7 将默认数据库MySQL替换成了Mariadb

这里会从系统的环境准备开始一步一步安装。

环境准备

系统版本 内核版本 IP地址
Centos 7.5 4.18.9-1.el7.elrepo.x86_64 10.0.0.3

备注 该系统采用MINI最小化安装,安装之后对系统进行了最基础的优化操作,操作过程点击这里

删除系统自带的依赖包

[root@node soft]# rpm -qa | egrep 'mysql|mariadb'
mariadb-libs-5.5.56-2.el7.x86_64
[root@node soft]# rpm -qa | egrep 'mysql|mariadb' | xargs rpm -e --nodeps
[root@node soft]# rpm -qa | egrep 'mysql|mariadb'
[root@node soft]#

创建MySQL运行用户

[root@node soft]# useradd -s /sbin/nologin -M mysql
[root@node soft]# grep mysql /etc/passwd
mysql:x:1000:1000::/home/mysql:/sbin/nologin

下载 MySQL

可以在mirrors.163.com的163源下载

下载地址

如果上面的下载地址失效了,则可以使用百度网盘:百度云盘

提取码:4qh6

[root@node soft]# wget http://mirrors.163.com/mysql/Downloads/MySQL-5.7/mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz
[root@node soft]# ls
mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz
# 解压
[root@node soft]# tar xf mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz
[root@node soft]# ls
mysql-5.7.23-linux-glibc2.12-x86_64 mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz

配置环境变量

[root@node soft]# mv mysql-5.7.23-linux-glibc2.12-x86_64 /opt/mysql-5.7.23
[root@node soft]# cd /opt/
[root@node opt]# ls
mysql-5.7.23 soft
[root@node opt]# chown -R mysql.mysql mysql-5.7.23
[root@node opt]# ll
total 0
drwxr-xr-x 9 mysql mysql 129 Sep 30 10:33 mysql-5.7.23
drwxr-xr-x 2 root root 56 Sep 30 10:34 soft
[root@node opt]# echo 'export PATH=$PATH:/opt/mysql-5.7.23/bin' >> /etc/profile
[root@node opt]# tail -1 /etc/profile
export PATH=$PATH:/opt/mysql-5.7.23/bin
[root@node opt]# source /etc/profile
[root@node opt]# mysql -V
mysql Ver 14.14 Distrib 5.7.23, for linux-glibc2.12 (x86_64) using EditLine wrapper

配置MySQL启动脚本并设置开机自启

二进制解压后的目录中,包括了MySQL的启动关闭脚本,可以使用,也可以自己写systemctl管理脚本

[root@node opt]# cd mysql-5.7.23/
[root@node mysql-5.7.23]# pwd
/opt/mysql-5.7.23
[root@node mysql-5.7.23]# ls
bin COPYING docs include lib man README share support-files
[root@node mysql-5.7.23]# cp support-files/mysql.server /etc/init.d/mysqld
[root@node mysql-5.7.23]# chmod +x /etc/init.d/mysqld
[root@node mysql-5.7.23]# sed -i 's#/usr/local/mysql#/opt/mysql-5.7.23#g' /etc/init.d/mysqld
[root@node mysql-5.7.23]# chkconfig --add mysqld
[root@node mysql-5.7.23]# chkconfig mysqld on
[root@node mysql-5.7.23]# chkconfig | grep mysqld Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'. mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off

初始化 MySQL

[root@node mysql-5.7.23]# pwd
/opt/mysql-5.7.23
[root@node mysql-5.7.23]# mkdir data
[root@node mysql-5.7.23]# mysqld --initialize --user=mysql --basedir=/opt/mysql-5.7.23 --datadir=/opt/mysql-5.7.23/data

配置文件

[root@node mysql-5.7.23]# cat my.cnf
[client]
socket = /tmp/mysql.sock
port=3306 [mysql]
default-character-set=utf8 [mysqld]
basedir=/opt/mysql-5.7.23
datadir=/opt/mysql-5.7.23/data
port=3306
pid-file=/opt/mysql-5.7.23/mysqld.pid
skip-name-resolve
socket = /tmp/mysql.sock
character-set-server=utf8
default-storage-engine=INNODB
explicit_defaults_for_timestamp = true
server-id=1
max_connections=2000
query_cache_size=0
table_open_cache=2000
tmp_table_size=246M
thread_cache_size=300
thread_stack = 192k
key_buffer_size=512M
read_buffer_size=4M
read_rnd_buffer_size=32M
innodb_data_home_dir = /opt/mysql-5.7.23/data
innodb_flush_log_at_trx_commit=0
innodb_log_buffer_size=16M
innodb_buffer_pool_size=256M
innodb_log_file_size=128M
innodb_thread_concurrency=128
innodb_autoextend_increment=1000
innodb_buffer_pool_instances=8
innodb_concurrency_tickets=5000
innodb_old_blocks_time=1000
innodb_open_files=300
innodb_stats_on_metadata=0
innodb_file_per_table=1
innodb_checksum_algorithm=0
back_log = 80
flush_time = 0
join_buffer_size = 128M
max_allowed_packet = 1024M
max_connect_errors = 2000
open_files_limit = 4161
query_cache_type = 0
sort_buffer_size = 32M
table_definition_cache = 1400
binlog_row_event_max_size = 8K
sync_master_info = 10000
sync_relay_log = 10000
sync_relay_log_info = 10000
bulk_insert_buffer_size = 64M
interactive_timeout = 120
wait_timeout = 120
log-bin-trust-function-creators=1
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [mysqld_safe]
log-error = /opt/mysql-5.7.23/error.log
pid-file = /opt/mysql-5.7.23/mysqld.pid

启动

[root@node mysql-5.7.23]# /etc/init.d/mysqld  start
Starting MySQL. SUCCESS!
[root@node mysql-5.7.23]# ps aux|grep mysql
root 8356 1.2 0.1 113320 3128 pts/0 S 10:35 0:00 /bin/sh /opt/mysql-5.7.23/bin/mysqld_safe --datadir=/opt/mysql-5.7.23/data --pid-file=/opt/mysql-5.7.23/mysqld.pid
mysql 9102 5.2 14.4 1776888 291536 pts/0 Sl 10:35 0:00 /opt/mysql-5.7.23/bin/mysqld --basedir=/opt/mysql-5.7.23 --datadir=/opt/mysql-5.7.23/data --plugin-dir=/opt/mysql-5.7.23/lib/plugin --user=mysql --log-error=/opt/mysql-5.7.23/error.log --open-files-limit=4161 --pid-file=/opt/mysql-5.7.23/mysqld.pid --socket=/tmp/mysql.sock --port=3306
root 9132 0.0 0.1 112716 2188 pts/0 S+ 10:35 0:00 grep --color=auto mysql
[root@node mysql-5.7.23]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.23 MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>

查看日志

[root@node mysql-5.7.23]# cat error.log
2018-10-08T02:35:19.046722Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2018-10-08T02:35:19.046763Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2018-10-08T02:35:19.046778Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-10-08T02:35:19.046792Z 0 [Note] /opt/mysql-5.7.23/bin/mysqld (mysqld 5.7.23) starting as process 9102 ...
2018-10-08T02:35:19.064739Z 0 [Note] InnoDB: PUNCH HOLE support available
2018-10-08T02:35:19.064772Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-10-08T02:35:19.064775Z 0 [Note] InnoDB: Uses event mutexes
2018-10-08T02:35:19.064777Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2018-10-08T02:35:19.064780Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-10-08T02:35:19.064782Z 0 [Note] InnoDB: Using Linux native AIO
2018-10-08T02:35:19.064794Z 0 [Note] InnoDB: Adjusting innodb_buffer_pool_instances from 8 to 1 since innodb_buffer_pool_size is less than 1024 MiB
2018-10-08T02:35:19.065357Z 0 [Note] InnoDB: Number of pools: 1
2018-10-08T02:35:19.065416Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-10-08T02:35:19.066693Z 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
2018-10-08T02:35:19.077288Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-10-08T02:35:19.079399Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-10-08T02:35:19.090732Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-10-08T02:35:19.096688Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-10-08T02:35:19.096750Z 0 [Note] InnoDB: Setting file '/opt/mysql-5.7.23/data/ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-10-08T02:35:19.107248Z 0 [Note] InnoDB: File '/opt/mysql-5.7.23/data/ibtmp1' size is now 12 MB.
2018-10-08T02:35:19.107796Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-10-08T02:35:19.107804Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-10-08T02:35:19.108372Z 0 [Note] InnoDB: 5.7.23 started; log sequence number 2589252
2018-10-08T02:35:19.108585Z 0 [Note] InnoDB: Loading buffer pool(s) from /opt/mysql-5.7.23/data/ib_buffer_pool
2018-10-08T02:35:19.109989Z 0 [Note] InnoDB: Buffer pool(s) load completed at 181008 10:35:19
2018-10-08T02:35:19.110083Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-10-08T02:35:19.112065Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2018-10-08T02:35:19.112078Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2018-10-08T02:35:19.112110Z 0 [Note] IPv6 is available.
2018-10-08T02:35:19.112115Z 0 [Note] - '::' resolves to '::';
2018-10-08T02:35:19.112145Z 0 [Note] Server socket created on IP: '::'.
2018-10-08T02:35:19.117779Z 0 [Note] /opt/mysql-5.7.23/bin/mysqld: ready for connections.
Version: '5.7.23' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Server (GPL)

centos 7 MysSQL 5.7.23 二进制安装的更多相关文章

  1. centos 7 MysSQL 5.6.39 二进制安装

    MySQL 5.6.39 二进制安装 CentOS 7 将默认数据库MySQL替换成了Mariadb. 这里会从系统的环境准备开始一步一步安装. 环境准备 系统版本 内核版本 IP地址 Centos ...

  2. centos 7 MysSQL 5.7.23 源码安装

    MySQL 5.7.23 源码安装 CentOS 7 将默认数据库MySQL替换成了Mariadb. 这里会从系统的环境准备开始一步一步安装. 环境准备 系统版本 内核版本 IP地址 Centos 7 ...

  3. CentOS 6.2 二进制安装apache2.4.3出现configure: error: APR-util not found. Please read the documentation的解决方

    CentOS 6.2 二进制安装apache2.4.3出现configure: error: APR-util not found. Please read the documentation的解决方 ...

  4. centos 7.3二进制安装mariadb10.2.8完美步骤

    (1)在centos7系统上,yum info mariadb可以找到提供mariadb包的官方网站,在到官方网站下载最新的mariadb包,然后rz到linux系统上去 (2)准备用户 1.user ...

  5. CentOS 6.5下二进制安装 MySQL 5.6

    CentOS 6.5 二进制安装MySQL 5.6 1:查看系统版本 [root@10-4-5-9 mysql]# cat /etc/redhat-release CentOS release 6.5 ...

  6. centos 7 MysSQL 5.6.39 源码安装

    MySQL 5.6.39 二进制安装 CentOS 7 将默认数据库MySQL替换成了Mariadb. 这里会从系统的环境准备开始一步一步安装. 环境准备 系统版本 内核版本 IP地址 Centos ...

  7. Centos 二进制安装node.js

    一.登录node的官网查看最新的稳定版,以及需要下载的Linux版本,你可以有多种Linux安装方式(源码安装,二进制安装等). 二.Node安装及配置 1.创建安装目录:创建目录node.js [r ...

  8. Centos7 二进制安装 Kubernetes 1.13

    目录 1.目录 1.1.什么是 Kubernetes? 1.2.Kubernetes 有哪些优势? 2.环境准备 2.1.网络配置 2.2.更改 HOSTNAME 2.3.配置ssh免密码登录登录 2 ...

  9. [sql]mysql5.6cmake安装/mysql5.7二进制安装

    centos7上cmake编译安装mysql-5.6.36.tar.gz 系统环境 - 环境(安装前规划好主机名,mysql编译过程会用) [root@n1 mysql-5.6.36]# cat /e ...

随机推荐

  1. Android自定义控件:自适应大小的文本控件

    需求 自适应大小的文本: 效果图: 项目开发中,开发人员根据UI人员提供的一套尺寸,布局了一些带文本的页面, 往往会少考虑一些数据极限的问题,造成机型屏幕适配问题. 例如: 文本(或数值)长度可变,如 ...

  2. Zabbix 四 主动模式

    本次的主机192.168.131.8 被动模式. 将zabbix4.4.4的源码包放过去,解压安装依赖准备编译安装,并创建zabbix账户. tar -xf zabbix-4.4.0.tar.gz & ...

  3. JS中获取元素属性的逆天大法

    给大家聊下js中获取元素属性的逆天大法,胆小慎入,切记切记!!! innerHTML.outerHTML.innerText .outerText.value.text().html(),val() ...

  4. Oracle“ORA-00911: 无效字符”解决方式

    在工作中碰到ORA-00911:无效字符的问题, 代码如下: <select id="querySendMsg" parameterType="map" ...

  5. CF480E Parking Lot(单调队列+dp然鹅并不是优化)

    (全英文题面所以直接放化简题意) 题意:在一个二维平面内,初始有一些点,然后每个时间点加入一些点,对每个时间点求平面内最大的无障碍正方形 (这次的题目是真的神仙啊...) 首先,考虑暴力,如果对每一个 ...

  6. PCA降维的原理、方法、以及python实现。

    PCA(主成分分析法) 1. PCA(最大化方差定义或者最小化投影误差定义)是一种无监督算法,也就是我们不需要标签也能对数据做降维,这就使得其应用范围更加广泛了.那么PCA的核心思想是什么呢? 例如D ...

  7. java数组、字符串拼接

    1. 数组实现拼接 int[] arr ={11,22,33,44,55,66}; System.out.print("["); for (int i = 0; i <arr ...

  8. map集合中哪些是线程安全的

    为什么HashMap是线程不安全的 总说 HashMap 是线程不安全的,不安全的,不安全的,那么到底为什么它是线程不安全的呢?要回答这个问题就要先来简单了解一下 HashMap 源码中的使用的存储结 ...

  9. spark集群搭建(三台虚拟机)——kafka集群搭建(4)

    !!!该系列使用三台虚拟机搭建一个完整的spark集群,集群环境如下: virtualBox5.2.Ubuntu14.04.securecrt7.3.6_x64英文版(连接虚拟机) jdk1.7.0. ...

  10. logback日志回顾整理--2018年8月8日

    几年前使用过logback作为项目的日志框架. 当时觉得这个框架比log4j更加好用. 所以系统的学习了一遍. 后来换了公司, 不再使用logback. 如今, 又有机会使用logback了, 所以, ...