centos7 安装 mysql5.7.25
一、检查是否安装了mysql和mariadb,若已经安装就需要卸载。
- [root@localhost ~]# rpm -qa|grep mariadb // 查询出来已安装的mariadb
- [root@localhost ~]# rpm -e --nodeps 文件名 // 卸载mariadb,文件名为上述命令查询出来的文件
[root@localhost ~]# rm /etc/my.cnf //删除配置文件
二、添加mysql用户及用户组
- [root@localhost ~]# groupadd mysql //创建mysql用户组
- [root@localhost ~]# useradd -g mysql mysql //创建mysql用户,并添加到mysql用户组
三、解压文件,并移动到指定的目录下
- [root@localhost ~]# tar -zvxf mysql-5.7.-linux-glibc2.-x86_64.tar.gz
- [root@localhost ~]# mv 解压出来的文件夹名 mysql
- [root@localhost ~]# mv mysql /usr/local/
四、创建配置文件
- [root@localhost support-files]# vim /etc/my.cnf
- #通过vim编辑器编辑my.cnf代码如下:
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
socket = /tmp/mysql.sock
character-set-server=utf8
log-error = /usr/local/mysql/data/mysqld.log
pid-file = /usr/local/mysql/data/mysqld.pid
五、初始化数据库
- [root@localhost ~]# cd /usr/local/mysql/bin/
- [root@localhost bin]# ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
六、查看初始默认密码
- [root@localhost bin]# cat /usr/local/mysql/data/mysqld.log
- --05T07::.263392Z [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
- --05T07::.263457Z [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.
- --05T07::.263462Z [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
- --05T07::.961752Z [Warning] InnoDB: New log files created, LSN=
- --05T07::.039265Z [Warning] InnoDB: Creating foreign key constraint system tables.
- --05T07::.095290Z [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: b858de41--11e9-84f3-00505681edfc.
- --05T07::.096413Z [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
- --05T07::.096953Z [Note] A temporary password is generated for root@localhost: kXJh+_RMu52K
七、将启动脚本放到开机初始化目录
- [root@localhost ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
八、启动mysql
- [root@localhost ~]# service mysql start
- Starting MySQL. SUCCESS!
九、使用root账号和默认密码登录mysql
- [root@localhost ~]# cd /usr/local/mysql/bin/
- [root@localhost bin]# ./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>
十、修改root密码
- mysql> set password=password('root');
- Query OK, rows affected, warning (0.00 sec)
- mysql> grant all privileges on *.* to root@'%' identified by '';
- Query OK, rows affected, warning (0.01 sec)
- mysql> flush privileges;
- Query OK, rows affected (0.00 sec)
十一、添加远程访问权限
- mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '' WITH GRANT OPTION;
- Query OK, rows affected, warning (0.00 sec)
十二、重启mysql
- [root@localhost bin]# service mysql restart
- Shutting down MySQL.. SUCCESS!
- Starting MySQL. SUCCESS!
centos7 安装 mysql5.7.25的更多相关文章
- CentOS6.3 编译安装LAMP(3):编译安装 MySQL5.5.25
所需源码包: /usr/local/src/MySQL-5.5.25/cmake-2.8.8.tar.gz /usr/local/src/MySQL-5.5.25/mysql-5.5.25.tar.g ...
- Centos7 安装 MySQL5.7
Centos7 安装 MySQL5.7 一.环境介绍 1.安装包版本介绍 MySQL 有三种安装方式:RPM安装.二进制包安装.源码包安装.我们这篇文章以二进制方式安装MySQL 软件名称 版本 系统 ...
- centos7安装mysql5.7.19及配置远程连接
centos7安装mysql5.7.19及配置远程连接------https://blog.csdn.net/Lh19931122/article/details/77996213
- CentOS7.x安装MySQL5.7.25
mysql 5.7下载地址 社区版下载地址:https://dev.mysql.com/downloads/mysql/ 可能会有变动 找到5.7版本, 注:源码安装需要用到下面的包,可以先忽略,我安 ...
- Centos7二进制文件安装MySQL5.7.25
1.删除centos系统自带的mariadb数据库防止发生冲突 rpm -qa|grep mariadb rpm -e mariadb-libs --nodeps 2.安装libaio库 yum -y ...
- Centos7安装Mysql5.7方法总结 - 实操手册
Centos7.x版本下针对Mysql的安装和使用多少跟之前的Centos6之前版本有所不同的,废话就不多赘述了,下面介绍下在centos7.x环境里安装mysql5.7的几种方法:一.yum方式安装 ...
- centos7 安装mysql5.7及配置
一.Mysql 各个版本区别:1.MySQL Community Server 社区版本,开源免费,但不提供官方技术支持.2.MySQL Enterprise Edition 企业版本,需付费,可以试 ...
- Linux学习第三步(Centos7安装mysql5.7数据库)
版本:mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar 前言:在linux下安装mysql不如windows下面那么简单,但是也不是很难.本文向大家讲解了如何在Cent ...
- Centos7安装mysql-5.7.19
Centos7安装Mysql 一 mysql下载 地址: https://dev.mysql.com/downloads/mysql/#downloads 二 在centos7上创建安装文件存放.解压 ...
随机推荐
- MySQL 快速添加百万条数据
需要向数据库添加100W条测试数据,直接在普通表中添加速度太慢,可以使用内存表添加,然后将内存表数据复制到普通表 创建表 # 内存表 DROP TABLE IF EXISTS `test_memory ...
- [转帖]编写shell脚本所需的语法和示例
编写shell脚本所需的语法和示例 https://blog.csdn.net/CSDN___LYY/article/details/100584638 在说什么是shell脚本之前,先说说什么是sh ...
- 以Integer类型传参值不变来理解Java值传参
最近在写代码的时候出了一个错误,由于对值引用理解的不深,将Integer传入方法中修改,以为传入后直接修改Integer中的值就不用写返回值接收了,虽然很快发现了问题,但还是来总结一下 首先是代码: ...
- 【转】用VMware 8安装Ubuntu 12.04详细过程(图解)
图解演示环境版本: 本机系统: WIN7 虚拟机:VMware Workstation 8 (英文版) 安装目标:Ubuntu Desktop 12.04 LTS (请点击这里)先下载好iso镜像文 ...
- Django学习——用户自定义models问题解决
一.问题在Django中使用自定义的model的时候会出现下面的错误 ERRORS: auth.User.groups: (fields.E304) Reverse accessor for 'Use ...
- 上下文的哲学思考:上下文=环境 & 上下文=对象+行为+环境
事物的存在和运行所依赖的全部资源(能够看到和使用的一切)(环境). 上下文研究的是一个时段内,多个主体.对象在历次操作活动时,在空间的信息投射. 上下文是事物存在和生存活动的气泡,气泡消失,事物消失. ...
- 关于django模型里面的__str__和__unicode__
python3 django模型里面 使用 __str__ 如果使用__unicode__是无效的 简而言之,就是__str__和__unicode__都是为了再管理站点中加载这个表时想显示什 ...
- 易百教程人工智能python补充-NLTK包
自然语言处理(NLP)是指使用诸如英语之类的自然语言与智能系统进行通信的AI方法. 如果您希望智能系统(如机器人)按照您的指示执行操作,希望听取基于对话的临床专家系统的决策时,则需要处理自然语言. N ...
- git操作:查看分支、删除本地分支和远程分支
1.查看本地分支:git branch 2.查看远程分支:git branch -r 或 git branch --remote 3.查看本地和远程的所有分支:git branch -a 4.删除本地 ...
- Centos下安装LoadRunner负载机
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAd0AAADfCAIAAAA84J6GAAAgAElEQVR4nJzb93cbR6In+uK/8v6Fd8