centos7 安装mysql5.7(二进制安装)
一、卸载默认安装的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(二进制安装)的更多相关文章
- [sql]mysql5.6cmake安装/mysql5.7二进制安装
centos7上cmake编译安装mysql-5.6.36.tar.gz 系统环境 - 环境(安装前规划好主机名,mysql编译过程会用) [root@n1 mysql-5.6.36]# cat /e ...
- CentOS6+MySQL5.6二进制安装
一般我们安装mysql采用二进制安装的方式就足以满足我们的生产环境了,不过需要我们配置my.cnf文件 从官网下载二进制MySQL,选择Linux-Generic,最后这两个是二进制包 http:// ...
- Linux中MySQL5.6编译安装与MySQL5.7二进制安装步骤
首先,介绍一下MySQL的几种安装方式 1.RPM.Yum 的安装方式:安装方便.安装速度快,无法定制 2.二进制:不需要安装,解压即可使用,不能定制功能 3.编译安装:可定制,安装慢. 编译安装中需 ...
- centos7下mysql5.7的安装与配置
centos7下MySQL5.7的安装与配置 下载 下载地址 根据系统和版本选择红框中的四个RPM包下载即可,然后放到centos7系统中的/opt目录下,等待稍后安装. 安装前的准备 1. 检查系统 ...
- CentOS7下MySQL5.7的安装-RPM方式
Installing MySQL on Linux Using RPM Packages 下载安装包 mysql下载地址:https://dev.mysql.com/downloads/mysql/ ...
- Centos7.3 之mysql5.7二进制安装
#!/bin/bash #注意,该脚本是在centos7.3非生产环境下测试的,其他版本的系统可能不适用,要根据情况修改.需要先下载好mysql二进制包到本地(我一般都是在root家目录下操作,文件也 ...
- centos 7下安装MySQL5.7 的安装和配置
原文链接: http://blog.csdn.net/xyang81/article/details/51759200 安装环境:CentOS7 64位 MINI版,安装MySQL5.7 1.配置Y ...
- centos7.2 mysql5.5编译安装
环境 centos7.2 源码包mysql5.5.38 mysql5.5开始,源码配置编译工具configure变成了cmake,所以先要去把cmake装上.并安装make,bison,cmake,g ...
- MySQL5.7二进制安装
MySQL-5.7.14从零开始-安装 首先我们要选择下载MySQL的版本: 登录官方网站下载:https://dev.mysql.com/downloads/mysql/ 下面我们选择5.7.14的 ...
- ubuntu mysql5.6二进制安装
200 ? "200px" : this.width)!important;} --> 介绍 以前一直使用centos今天需要对一台ubantu的系统安装mysql,虽然它也 ...
随机推荐
- 常见的几种 Normalization 算法
神经网络中有各种归一化算法:Batch Normalization (BN).Layer Normalization (LN).Instance Normalization (IN).Group No ...
- 原创的离线版 Redis 教程,给力!
嗯,你没看错,松哥又给大家送干货来了.这次是可以离线阅读的 PDF 版教程哦. 之前一直有小伙伴问我有没有 Redis 的电子书,老实说,有是有,但是公开给大家分享,其实有一点点风险,毕竟这都是有版权 ...
- Java基础扫盲系列(三)— Java内省技术
前言 Java内省技术属于Java基础体系的的一部分,但是很多人都不甚了解.笔者也是在学习Spring源码的过程中遇到该技术模块的.为了完善技术体系,本文将全面的学习该技术.在提到Java内省技术,就 ...
- 转 OpenCV Mat 数据读写
转:https://blog.csdn.net/u011520181/article/details/83831866 1.创建 Mat 对象: // 创建一个 320x240 的 8 位无符号型 4 ...
- 配置 ASP.NET Core 请求(Request)处理管道
配置 ASP.NET Core 请求(Request)处理管道 在本节中,我们将讨论使用中间件组件为 asp.net core 应用程序配置请求处理管道. 作为应用程序启动的一部分,我们要在Confi ...
- C# - VS2019调用ZXing.NET实现条码、二维码和带有Logo的二维码生成
前言 C# WinFrm程序调用ZXing.NET实现条码.二维码和带有Logo的二维码生成. ZXing.NET导入 GitHub开源库 ZXing.NET开源库githib下载地址:https:/ ...
- LeetCode: 404.左叶子节点
计算给定二叉树的所有左叶子之和. 示例: 3 / \ 9 20 / \ 15 7 在这个二叉树中,有两个左叶子,分别是 9 和 15,所以返回 24 解析 我们需要找到这样的节点 属于叶子节点 属于父 ...
- ubuntu下编译android jni到so库的mk文件配置
项目根目录下的Android.mk文件 LOCAL_PATH:= $(call my-dir)include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional L ...
- 强大的 strace 工具
什么是 strace strace是Linux环境下的一款程序调试工具,用来监察一个应用程序所使用的系统调用. Strace是一个简单的跟踪系统调用执行的工具.在其最简单的形式中,它可以从开始到结束跟 ...
- DjangoForm 提交验证
用户提交数据的验证 1.创建模版 -- class LoginForm(forms.Form):.... 2.将请求交给模版,创建一个对象 -- obj = LoginForm(request.POS ...