CentOS RPM 安装 MySQL5.7
环境
CentOS 7 64位
MySQL 5.7 64位
1.卸载系统自带的 mariadb
[root@localhost /]# rpm -qa|grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
[root@localhost /]# rpm -e mariadb-libs-5.5.56-2.el7.x86_64 --nodeps
2.下载RPM包
到MySQL官网下载rpm集合包到本地再上传至服务器或通过下面的方法直接在服务器下载
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-1.el7.x86_64.rpm-bundle.tar
3.解压tar包
[root@localhost softwares]# ls
mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar
[root@localhost softwares]# tar -xvf mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar
mysql-community-server-5.7.18-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.18-1.el7.x86_64.rpm
mysql-community-devel-5.7.18-1.el7.x86_64.rpm
mysql-community-client-5.7.18-1.el7.x86_64.rpm
mysql-community-common-5.7.18-1.el7.x86_64.rpm
mysql-community-embedded-5.7.18-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.18-1.el7.x86_64.rpm
mysql-community-libs-5.7.18-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.18-1.el7.x86_64.rpm
mysql-community-test-5.7.18-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.18-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.18-1.el7.x86_64.rpm
4.安装
依次执行(几个包有依赖关系,所以执行有先后)下面命令安装
rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
5.数据库初始化
mysqld --initialize --user=mysql
--initialize 选项默认以“安全”模式来初始化,则会为 root 用户生成一个密码并将该密码标记为过期(密码在/var/log/mysqld.log中),登陆后你需要设置一个新的密码,而使用 --initialize-insecure 命令则不使用安全模式,则不会为 root 用户生成一个密码。
[root@localhost softwares]# more /var/log/mysqld.log
2018-02-24T08:27:17.789803Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-02-24T08:27:18.923811Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-02-24T08:27:18.981104Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-02-24T08:27:19.116973Z 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: 87296646-193c-11e8-adaf-000c29ee8fae.
2018-02-24T08:27:19.332937Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-02-24T08:27:19.333647Z 1 [Note] A temporary password is generated for root@localhost: m)6_=8yl6(pA
最后一行给出了MySQL登录密码。
启动MySQL服务,登录MySQL
[root@localhost softwares]# systemctl start mysqld
[root@localhost softwares]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18
Copyright (c) 2000, 2017, 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>
6.重置root用户密码
提示密码过期,需要重置
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
重置密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
或
mysql> set password for 'root'@'localhost'=password('new_password');
7.远程授权登录
root 用户名
% 所有人都可以访问
password 密码
# 给特定IP授权
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.100' IDENTIFIED BY 'password' WITH GRANT OPTION;
# 给任意IP授权
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
刷新权限
flush privileges;
打开3306端口
firewall-cmd --add-port=3306/tcp --permanent
重启防火墙
systemctl restart firewalld
8.配置utf8编码
修改/etc/my.cnf,在后面加上下面内容
[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'
重启MySQL
systemctl restart mysqld
显示编码
show variables like '%character%';
常见错误
[root@VM_107_38_centos tools]# rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.18-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.18-1.el7.x86_64
libnuma.so.1(libnuma_1.1)(64bit) is needed by mysql-community-server-5.7.18-1.el7.x86_64
libnuma.so.1(libnuma_1.2)(64bit) is needed by mysql-community-server-5.7.18-1.el7.x86_64
解决办法:
yum install libnuma*
错误:依赖检测失败:
perl(Getopt::Long) 被 mysql-community-server-5.7.18-1.el7.x86_64 需要
perl(strict) 被 mysql-community-server-5.7.18-1.el7.x86_64 需要
解决办法:
yum install perl
参考链接:
1.https://my.oschina.net/Laily/blog/713022
2.http://www.cnblogs.com/maobuji/p/8336702.html
CentOS RPM 安装 MySQL5.7的更多相关文章
- CentOS RPM安装MySQL-5.6
1.检查是否有安装 安装之前应该先查询系统是否自在了mysql的软件包 rpm -qa|grep -i mysql 如果有的话需要先删除 rpm -e 软件名 --nodeps 2.下载安装包 cd/ ...
- linux 环境RPM 安装MYSQL5.6
linux 环境RPM 安装MYSQL5.6 系统环境 CentOS7.2 1.关闭selinux 服务[SELinux是一种基于域-类型 模型(domain-type)的强制访问控制(MAC)安全系 ...
- RPM安装MYSQL5.7
RPM安装MYSQL5.7 1:YUM安装依赖库 yum install perl libaio numactl 2:下载安装需要的RPM包 https://dev.mysql.com/get/Dow ...
- RPM安装MySQL5.7并更改数据目录
RPM安装MySQL5.7并更改数据目录 文末附MySQL完整配置文件 官网地址:https://dev.mysql.com/downloads/mysql/5.7.html#downloads 注意 ...
- Centos6下rpm安装MySQL5.6
Centos6在rpm安装 rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm yum install ...
- 在centos上安装mysql5.7的三种方法
带OS信息的是已编译的二进制文件,不带OS信息的是源码包 mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz 二进制包 mysql-5.5.51.tar.gz 源码包 ...
- centos 7安装mysql5.5
首先centos7 已经不支持mysql,因为收费了你懂得,所以内部集成了mariadb,而安装mysql的话会和mariadb的文件冲突,所以需要先卸载掉mariadb,以下为卸载mariadb,安 ...
- CentOS在线安装Mysql5.7
一.通过Yum命令安装 1.下载rpm安装源 官方地址:https://dev.mysql.com/downloads/repo/yum/ rpm文件地址:https://dev.mysql.com/ ...
- Centos6 rpm 安装mysql5.5(转)
版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/macfac/article/details/51868712 0. 到官网下载好,想要安装的rpm包 ...
随机推荐
- 从源码看commit和commitAllowingStateLoss方法区别
Fragment介绍 在很久以前,也就是我刚开始写Android时(大约在2012年的冬天--),那时候如果要实现像下面微信一样的Tab切换页面,需要继承TabActivity,然后使用TabHost ...
- HLS图像处理总结(一)
HLS工具 以个人的理解,xilinx将HLS(高层次综合)定位于更方便的将复杂算法转化为硬件语言,通过添加某些配置条件HLS工具可以把可并行化的C/C++的代码转化为vhdl或verilog,相比于 ...
- Qt QString类及常用函数功能详解
QString 是 Qt 编程中常用的类,除了用作数字量的输入输出之外,QString 还有很多其他功能,熟悉这些常见的功能,有助于灵活地实现字符串处理功能. QString 存储字符串釆用的是 Un ...
- 体验vSphere 6之1-安装VMware ESXi 6 RC版(转载)
体验vSphere 6之1-安装VMware ESXi 6 RC版 在2015年,各个公司都会发布一系列新的产品,例如Microsoft会发布Windows 10,VMware会发布vSphere 6 ...
- mudbox卸载/完美解决安装失败/如何彻底卸载清除干净mudbox各种残留注册表和文件的方法
在卸载mudbox重装mudbox时发现安装失败,提示是已安装mudbox或安装失败.这是因为上一次卸载mudbox没有清理干净,系统会误认为已经安装mudbox了.有的同学是新装的系统也会出现mud ...
- Spring Boot 学习笔记(六) 整合 RESTful 参数传递
Spring Boot 学习笔记 源码地址 Spring Boot 学习笔记(一) hello world Spring Boot 学习笔记(二) 整合 log4j2 Spring Boot 学习笔记 ...
- cesium入门示例-geoserver服务访问
1.wms服务访问 //wms服务 viewer.imageryLayers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({ ...
- 编程原理—如何用javascript代码解决一些问题
关于编程,我最喜欢的就是解决问题.我不相信有谁天生具有解决问题的能力.这是一种通过反复锻炼而建立并维持的能力.像任何练习一样,有一套指导方针可以帮助你更有效地提高解决问题的能力.我将介绍5个最重要的软 ...
- 「CometOJ」Contest #11
Link Aeon 显然字典序最大就是把最小的字母放在最后 Business [动态规划] 简单dp dp[i][j]dp[i][j]dp[i][j]表示到第iii天,当前有jjj块钱,最后返还的钱最 ...
- shell的循环嵌套语法
测试shell的循环嵌套语法 [root@localhost test]# vi Xunhuanqiantao.sh #!/bin/bash #程序功能描述: # 测试循环嵌套 #作者:孤舟点点 #版 ...