1.详细描安装的过程

1.1关闭防火墙

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

1.2 检查是否安装NySQL,如果安装 卸载之

rpm -qa |grep mysql
yum remove mysql*

1.3 检查是否安装MariaDB,如果安装 卸载之(重要)

rpm -qa |grep mariadb
yum remove mariadb*

1.4 新增用户/组 参数文件

groupadd mysql
useradd -d /home/mysql -g mysql -m mysql
passwd mysql
mysql vi ~/.bash_profile # .bash_profile # Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi # User specific environment and startup programs PATH=$PATH:$HOME/.local/bin:$HOME/bin:/u01/MySQL5.7/bin export PATH [mysql@localhost ~]$ source .bash_profile

1.5 规划目录 赋权限

mkdir -p /u01/MySQL5.7       

mkdir -p /MySQL/my3306/data
mkdir -p /MySQL/my3306/log/iblog
mkdir -p /MySQL/my3306/log/binlog
mkdir -p /MySQL/my3306/run
mkdir -p /MySQL/my3306/tmp chown -R mysql:mysql /MySQL/my3306
chown -R mysql:mysql /u01/MySQL5.7
##chown -R 755 /MySQL/my3307

1.6 下载mysql安装介质到目标机器

[root@localhost ~]# cd /u01/MySQL5.7
[root@localhost MySQL5.7]# ll
total 0
[root@localhost MySQL5.7]# ll
total 696028
-rw-r--r--. 1 mysql mysql 712729170 May 14 01:42 mysql-5.7.22-el7-x86_64.tar.gz

1.8 解压

[mysql@localhost  MySQL5.7]# tar -xzvf mysql-5.7.22-el7-x86_64.tar.gz  

[mysql@localhost MySQL5.7]# mv  /u01/MySQL5.7/mysql-5.7.22-el7-x86_64/* /u01/MySQL5.7/

1.9初始化数据库

[mysql@localhost ~]$ mysqld --initialize --user=mysql --basedir=/u01/MySQL5.7  --datadir=/MySQL/my3306/data  --explicit_defaults_for_timestamp
2018-05-14T05:52:52.741612Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2018-05-14T05:52:52.742026Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2018-05-14T05:52:53.946033Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-05-14T05:52:54.104581Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-05-14T05:52:54.201291Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 0b79b507-573b-11e8-89dd-000c29a1762c.
2018-05-14T05:52:54.203218Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-05-14T05:52:54.210927Z 1 [Note] A temporary password is generated for root@localhost: ;c_tca9sR;s5

由上可知,初始化的root 密码为;c_tca9sR;s5

1.10编辑参数文件 my.cnf

vi /MySQL/my3306/my.cnf

[mysqld]
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
basedir=/u01/MySQL5.7 #介质目录
datadir=/MySQL/my3306/data #数据目录
port=3306 #端口
pid-file = /MySQL/my3306/data/mysql.pid #进程id
user = mysql #启动用户
socket=/MySQL/my3306/run/mysql.sock #sock文件地址
bind-address = 0.0.0.0 #绑定ip 这里表示绑定所有ip
server-id = 1 #用于复制环境钟标识实例,这个在复制环境里唯一
character-set-server = utf8 #服务端默认字符集,很重要,错误设置会出现乱码
max_connections = 1000 #允许客户端并发连接的最大数量
max_connect_errors = 6000 #如果客户端尝试连接的错误数量超过这个参数设置的值,则服务器不再接受新的客户端连接。
open_files_limit = 65535 #操作系统允许MySQL服务打开的文件数量。
table_open_cache = 128 #所有线程能打开的表的数量
max_allowed_packet = 4M #网络传输时单个数据包的大小。
binlog_cache_size = 1M
max_heap_table_size = 8M
tmp_table_size = 16M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 8M
key_buffer_size = 4M
thread_cache_size = 8
query_cache_type = 1
query_cache_size = 8M
query_cache_limit = 2M
ft_min_word_len = 4
log_bin = mysql-bin
binlog_format = mixed
expire_logs_days = 30
log_error = /MySQL/my3306/data/mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /MySQL/my3306/data/mysql-slow.log
performance_schema = 0
explicit_defaults_for_timestamp
#lower_case_table_names = 1
skip-external-locking
default_storage_engine = InnoDB
#default-storage-engine = MyISAM
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 64M
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
bulk_insert_buffer_size = 8M
myisam_sort_buffer_size = 8M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
interactive_timeout = 28800
wait_timeout = 28800
#lower_case_table_names = 1
skip-external-locking
default_storage_engine = InnoDB
#default-storage-engine = MyISAM
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 64M
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
bulk_insert_buffer_size = 8M
myisam_sort_buffer_size = 8M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
interactive_timeout = 28800
wait_timeout = 28800 [client]
port=3306
socket=/MySQL/my3306/run/mysql.sock [mysql]
socket=/MySQL/my3306/run/mysql.sock

1.11拷贝my.cnf 以及 mysql.server

cp /MySQL/my3306/my.cnf /etc/my.cnf
cp /u01/MySQL5.7/support-files/mysql.server /etc/init.d/mysqld

1.12编辑 /etc/init.d/mysqld

#添加一下两项
basedir=/u01/MySQL5.7
datadir=/MySQL/my3306/data

1.13.启动数据库

[mysql@localhost ~]$ service mysqld start
Starting MySQL.. SUCCESS!

1.14.连接数据库 更新初始密码

[mysql@localhost ~]$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.22-log 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>
mysql>
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> set PASSWORD=PASSWORD('root');
Query OK, 0 rows affected, 1 warning (0.03 sec) mysql> flush privileges;

1.15.配置mysql开机启动

[root@localhost ~]# chkconfig mysqld on
[root@localhost ~]# chkconfig 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
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off

centos7 二进制安装MySQL5.7.22的更多相关文章

  1. CentOS-7下安装MySQL5.6.22

    参考: http://www.2cto.com/database/201501/371451.html 安装环境   CentOS版本:CentOS-7 因为之前安装过,没有成功,但是有之前安装的文件 ...

  2. 021-centos6.5上二进制安装mysql5.7.22

    思路: 下载上传mysql的二进制安装包. 准备好mysql的用户.安装目录basedir.数据目录datadir.配置文件/etc/my.cnf. 初始化出数据库. 配置启动服务. 开机启动. 配置 ...

  3. CentOS7.5安装Mysql5.7.22

    一 下载 下载地址:https://www.mysql.com/downloads/ 1 点击第一个链接地址,进入MySQL官方网站,单击“Downloads”下载Tab页,进入下载界面 2 找到Co ...

  4. centos7 二进制安装mysql5.6

    下载mysqltar包 wget -q http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.g ...

  5. CentOS7怎样安装MySQL5.7.22

    wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm下载mysql源安装包 yum install mysq ...

  6. Salt之CentOS7.5使用RPM包安装MySQL5.7.22

    手动安装参考CentOS7.5使用RPM包安装MySQL5.7.22 目录结构为 install.sls文件 #按顺序分别安装commin libs client server #避免冲突安装comm ...

  7. Linux(CentOS7)下二进制安装MySQL5.7.26

    记录一下自己在 CentOS7 下二进制安装 MySQL5.7.26 的过程,之前使用 Linux(CentOS7)下rpm安装MySQL8.0.16 之后发现 rpm 方式安装不利于维护,也不利于单 ...

  8. 在 CentOS7 上安装 MySQL5.7

    在 CentOS7 上安装 MySQL5.7 1 通过 SecureCRT 连接到阿里云 CentOS7 服务器: 2 进入到目录 /usr/local/ 中: cd /usr/local/ 3 创建 ...

  9. Centos7 二进制安装 Kubernetes 1.13

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

随机推荐

  1. HDU-5700-贪心/stl

    区间交 Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submiss ...

  2. C#对象初始或器-Chapter3 P38

    protected string GetMessage() { //如何构造和初始化泛型集合库中的一个数组和两个类. Product myProduct = ,Name="Kayak&quo ...

  3. Ubuntu 分区方安

    方案一: / 40G/boot 200MBswap 1G-2G /home 20G 剩 下的分为几个独立的分区,不用指定挂载点,而是安装完成后修改 /etc/fstab ,将这些区挂载在/home的子 ...

  4. HTTP相关知识点

    一.工作原理       HTTP协议工作于客户端-服务器架构上.浏览器作为HTTP客户端通过URL向HTTP服务端(即web服务端)发送所有请求. Web服务器接收到请求后,向客户端发送相应的响应信 ...

  5. 快速切题CF 158B taxi 构造 && 82A double cola 数学观察 难度:0

    实在太冷了今天 taxi :错误原因1 忽略了 1 1 1 1 和 1 2 1 这种情况,直接认为最多两组一车了 2 语句顺序错 double cola: 忘了减去n的序号1,即n-- B. Taxi ...

  6. zz VS2010配色方案

    http://studiostyles.info 这个网站专门为vs 2005, vs 2008, vs2010提供配色方案下载. 网站首页罗列出大量的配色方案,都附有缩略图以及rated(评估),d ...

  7. Python 编程核心知识体系-基础|数据类型|控制流(一)

    Python知识体系思维导图: 基础知识 数据类型 1.序列 2.字符串 3.列表和元组 4.字典和集合 循环 & 判断

  8. hadoop安装单机

    java环境安装 http://www.cnblogs.com/zeze/p/5902124.html java 环境安装配置 etc/profile: export JAVA_HOME=/usr/j ...

  9. 第24课 #pragma使用分析

    #pragma是C语言留给编译器厂商进行扩展用的. 这个关键字在不同的编译器之间也许是不能够移植的. #pragma简介 #pragma message #pragma message打印的消息并不代 ...

  10. springboot读取配置文件的顺序

    前言 今天测试一些东西,发现配置文件连接的数据库一直不正常,数据也不对,今天请教了之后,原来springboot的配置文件加载不仅仅是项目内的配置文件. 正文 项目目录是这样的:文件夹下有:项目,ap ...