一、卸载默认安装的mariadb

[root@localhost ~]# yum remove mariadb* -y

二、添加mysql用户

[root@localhost ~]# useradd -s /sbin/nologin -M mysql
#-s 指定shell
#-M 不创建家目录

三、解压tar文件并移动到指定目录

[root@localhost ~]# tar zxvf mysql-5.7.-linux-glibc2.-x86_64.tar.gz
[root@localhost ~]# mv mysql-5.7.-linux-glibc2.-x86_64 mysql
[root@localhost ~]# mv mysql /usr/local/mysql

四、修改目录所属

[root@localhost ~]# chown -R mysql:mysql /usr/local/mysql/

五、初始化mysql

[root@localhost ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
--08T01::.343294Z [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
--08T01::.491621Z [Warning] InnoDB: New log files created, LSN=
--08T01::.530234Z [Warning] InnoDB: Creating foreign key constraint system tables.
--08T01::.587027Z [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: 7d4db01d-b97b-11e9-8ac2-000c290afcba.
--08T01::.588261Z [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
--08T01::.590350Z [Note] A temporary password is generated for root@localhost: 2op_Dr?L)klu

六、创建系统服务,并修改参数

[root@localhost ~]# cp /usr/local/mysql/support-files/mysql.server  /etc/init.d/mysqld
[root@localhost ~]# vi /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
#修改上边俩行参数,添加指定的mysql目录和数据目录

七、编辑配置文件

[root@localhost ~]# vi /etc/my.cnf
[mysqld]
user= mysql
port=
socket=/tmp/mysql.sock
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
log-error=/usr/local/mysql/data/mysql.log
pid-file=/usr/local/mysql/data/mysql.pid
character-set-server=utf8
collation-server=utf8_bin

八、添加环境变量

[root@localhost ~]# vi .bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin
#添加上边这行环境变量
[root@localhost ~]# source .bash_profile 

九、启动mysql

[root@localhost ~]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!

十、修改mysql密码及允许远程登录

[root@localhost ~]# mysql -uroot -p
Enter password: #密码为初始化时,自动生成的密码
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.7. Copyright (c) , , 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> set password=password('');
Query OK, rows affected, warning (0.00 sec) mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed mysql> select host,user from user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+---------------+
rows in set (0.00 sec) mysql> update user set host='%' where user='root';
Query OK, row affected (0.00 sec)
Rows matched: Changed: Warnings: mysql> flush privileges;
Query OK, rows affected (0.00 sec)

十一、添加系统服务及设置自启动

[root@localhost ~]# chkconfig --add mysqld
[root@localhost ~]# chkconfig --level mysqld on

注:记得关闭防火墙或者添加防火墙策略

centos7 安装mysql5.7(二进制安装)的更多相关文章

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

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

  2. CentOS6+MySQL5.6二进制安装

    一般我们安装mysql采用二进制安装的方式就足以满足我们的生产环境了,不过需要我们配置my.cnf文件 从官网下载二进制MySQL,选择Linux-Generic,最后这两个是二进制包 http:// ...

  3. Linux中MySQL5.6编译安装与MySQL5.7二进制安装步骤

    首先,介绍一下MySQL的几种安装方式 1.RPM.Yum 的安装方式:安装方便.安装速度快,无法定制 2.二进制:不需要安装,解压即可使用,不能定制功能 3.编译安装:可定制,安装慢. 编译安装中需 ...

  4. centos7下mysql5.7的安装与配置

    centos7下MySQL5.7的安装与配置 下载 下载地址 根据系统和版本选择红框中的四个RPM包下载即可,然后放到centos7系统中的/opt目录下,等待稍后安装. 安装前的准备 1. 检查系统 ...

  5. CentOS7下MySQL5.7的安装-RPM方式

    Installing MySQL on Linux Using RPM Packages 下载安装包 mysql下载地址:https://dev.mysql.com/downloads/mysql/ ...

  6. Centos7.3 之mysql5.7二进制安装

    #!/bin/bash #注意,该脚本是在centos7.3非生产环境下测试的,其他版本的系统可能不适用,要根据情况修改.需要先下载好mysql二进制包到本地(我一般都是在root家目录下操作,文件也 ...

  7. centos 7下安装MySQL5.7 的安装和配置

    原文链接:  http://blog.csdn.net/xyang81/article/details/51759200 安装环境:CentOS7 64位 MINI版,安装MySQL5.7 1.配置Y ...

  8. centos7.2 mysql5.5编译安装

    环境 centos7.2 源码包mysql5.5.38 mysql5.5开始,源码配置编译工具configure变成了cmake,所以先要去把cmake装上.并安装make,bison,cmake,g ...

  9. MySQL5.7二进制安装

    MySQL-5.7.14从零开始-安装 首先我们要选择下载MySQL的版本: 登录官方网站下载:https://dev.mysql.com/downloads/mysql/ 下面我们选择5.7.14的 ...

  10. ubuntu mysql5.6二进制安装

    200 ? "200px" : this.width)!important;} --> 介绍 以前一直使用centos今天需要对一台ubantu的系统安装mysql,虽然它也 ...

随机推荐

  1. h5中的audio音频标签与对应的dom对象

    HTML5中提供了一个<audio>标签,同时也提供了一个Audio对象给JavaScript去操作,这个对象属于HTML的DOM对象. H5中的<audio>标签 此标签是H ...

  2. JDBC解耦案例

    原始JDBC连接 package jdbc; import org.junit.jupiter.api.Test; import java.sql.Connection; import java.sq ...

  3. mongodb复杂条件查询 (or与and)

    分类专栏: mongodb   版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/tjbsl/ ...

  4. yield return,yield break

    转自, http://www.cnblogs.com/kingcat/archive/2012/07/11/2585943.html yield return 表示在迭代中下一个迭代时返回的数据,除此 ...

  5. ASP.NET Core中的jQuery Unobtrusive Ajax帮助器

    最近在ASP.NET Core下写文章管理系统时,准备在分页显示文章内容时,使用Ajax.网上找了篇帖文,简单翻一下,仅供自己查阅. 原链接:https://dotnetthoughts.net/jq ...

  6. 避免HBase PageFilter踩坑,这几点你必须要清楚

    有这样一个场景,在HBase中需要分页查询,同时根据某一列的值进行过滤. 不同于RDBMS天然支持分页查询,HBase要进行分页必须由自己实现.据我了解的,目前有两种方案, 一是<HBase权威 ...

  7. jmeter实操及性能测试基础知识整理 - 不断更新

    主要基于jmetet工具 有任何疑问直接留言,可以相互讨论 线程组菜单: 线程数:并发数量Rame-Up时间(秒):多久跑完线程数,比如线程是10,Rame-Up时间是10秒,就是10秒内跑完10个线 ...

  8. Java自学-集合框架 HashSet

    Java集合框架 HashSet 示例 1 : 元素不能重复 Set中的元素,不能重复 package collection; import java.util.HashSet; public cla ...

  9. 基于hashlib下的文件校验

    hashlib不仅可以对密码进行加密也可以对文件内容进行校验,传统的小文件校验通过人为校验是不现实的,如果摸个文件里面的内容多出一个空格的话那么哦是根本就不知道的因此我们需要一个可以校验文件的方法,而 ...

  10. 【Git版本控制】Idea中设置Git忽略对某些文件的版本追踪

    在Idea中有些本地文件无需与远程库同步,仅是本地使用.此时就需要将这些文件加入到Git的版本忽略中来. 设置步骤 1.搜索插件 .ignore,并安装 2.增加.gitignore文件 3.配置相应 ...