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. 如何获取比 dism.log 更详细的日志

    正文 在工作中,曾经遇到过一个问题. 有一个 component,名字叫做 Oxford Adaptive Learning Dictionary,是一款牛津词典的应用.这个 component,需要 ...

  2. python3openpyxl库的简单使用

    python3操作表格有很多库,现在主要给大家介绍一下我比较喜欢用的openpyxl库,安装直接pip安装,对pip安装有疑问可以参考我有关于pip使用的文章. wb=Workbook()#新建表格 ...

  3. 在mac上用parallels创建双windows虚拟机调试windows驱动

    先创建两个windows 7 虚拟机,一个装windbg作为调试机,一个被调试 1 调试机 1 先装windbg https://developer.microsoft.com/en-us/windo ...

  4. day1 晚上 P4145 上帝造题的七分钟2 / 花神游历各国 线段树

    #include<iostream> #include<cstdio> #include<cmath> using namespace std; ; struct ...

  5. python购物车练习题

    # 购物车练习# 1.启动程序后,让用户输入工资,打印商品列表# 2.允许用户根据商品编号购买商品# 3.用户选择商品后,检测余额是否够,够就直接扣款,不够就提醒# 4.可随时退出,退出时,打印已购买 ...

  6. python——掌握sorted函数的用法

    看本篇文章的前提是掌握 00函数的基本概念.01函数参数传递方式 可参考本人博客文章 sorted函数 是一个内建函数,接收一个可迭代对象,按照指定类型.指定顺序进行排序,特点是返回一个新的列表,不改 ...

  7. java笔试面试第一天

    好久未曾启用我的博客,最近来上海找工作,想将笔试面试的过程做个记录,毕竟有总结才有提高嘛.今天算是笔试面试正式开始第一天吧,以下就是我的笔试总结(没有原题了,只有知识点): 笔试题1:java sta ...

  8. JVM 运行参数 & 代码监控

    1.Java代码监控 JDK提供java.lang.management包, 其实就是基于JMX技术规范,提供一套完整的MBean,动态获取JVM的运行时数据,达到监控JVM性能的目的. packag ...

  9. .NET单例模式快速学习应用

    单例模式属于设计模式中最简单的一个模式,在实际应用中也非常广泛,但可能是受到各类教程的影响,看到很多实现方式仍然沿用Java的那一套,其实在.NET中可以用更简洁的实现方式. 一.知识点介绍 核心目标 ...

  10. 解决vuex的数据刷新(F5)后会被初始化的问题

    介绍一个vuex的数据刷新(F5)后会被初始化的问题处理的插件:vuex-localstorage 实现的原理大概就是监听浏览器的刷新,关闭事件,把vuex的值存储到本地localstorage,刷新 ...