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. 找不到 cucumber.api.cli.Main 的报错解决方案

    最近玩IDEA,发现导入的项目有问题,报了一个“找不到或者不存在cucumber.api.cli.Main”的错误. 后来发现是新版的IDEA在导入时没有提示,以至于我没有配置项目对应的Tomcat服 ...

  2. 9、pytest -- 集成文档测试

    目录 1. 集成doctest模块 1.1. 通过指定文本文件的方式 1.2. 通过编写文档字符串的方式 1.3. 指定额外的选项 2. 失败时继续执行 3. 指定输出的格式 4. 文档测试中使用fi ...

  3. 一个基于Net Core3.0的WPF框架Hello World实例

    目录 一个基于Net Core3.0的WPF框架Hello World实例 1.创建WPF解决方案 1.1 创建Net Core版本的WPF工程 1.2 指定项目名称,路径,解决方案名称 2. 依赖库 ...

  4. Mongo 导出为csv文件

    遇到需要从Mongo库导出到csv的情况,特此记录. 先贴上在mongo目录下命令行的语句: ./mongoexport -h 10.175.54.77 -u userName -p password ...

  5. Python安装cx_Oracle与操作数据测试小结

    这里简单总结一下Python操作Oracle数据库这方面的相关知识.只是简单的整理一下之前的实验和笔记.这里的测试服务器为CentOS Linux release 7.5. 个人实验.测试.采集数据的 ...

  6. PL/SQL软件执行命令出现动态执行表不可访问,本会话的自动统计被禁止

    出现这样的原因是该用户没有相关权限. 解决方法: 去除软件层面设置

  7. 这次,我是如何监控服务器CPU和内存的

    背景 在新项目A中,要结合业务做性能测试.对于做过N次性能测试的我,这次有些巧妇有难无米之炊的感觉.以往的项目,服务器都是部署在AWS或者阿里云,像这样的云服务器厂商是可以通过轻松配置各种Dashbo ...

  8. 【vue】在VS Code中调试Jest单元测试

    在VS Code中调试Jest单元测试 添加调试任务 打开 vscode launch.json 文件,在 configurations 内加入下面代码 "configurations&qu ...

  9. mysql用find_in_set代替like搜索提高性能

    mysql用find_in_set代替like搜索提高性能 <pre>SELECT * from mobantestinfo1 where find_in_set('33',info2); ...

  10. Ansibile之playbook初识

    一.playbook简介 ansiblie的任务配置文件被称为playbook,俗称“剧本”,每一个剧本(playbook)中都包含了一系列的任务,这每个任务在ansible中又被称为“戏剧”(pla ...