Centos7.3离线(rpm方式)安装mysql服务
1、mysql官网下载安装包,官网地址:www.mysql.com
[root@seiang software]# ll
total 580020
-rw-r--r--. 1 root root 593940480 Mar 25 18:57 mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar
2、解压
[root@seiang software]# tar xvf mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar
mysql-community-embedded-devel-5.7.21-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.21-1.el7.x86_64.rpm
mysql-community-common-5.7.21-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.21-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.21-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.21-1.el7.x86_64.rpm
mysql-community-client-5.7.21-1.el7.x86_64.rpm
mysql-community-server-5.7.21-1.el7.x86_64.rpm
mysql-community-embedded-5.7.21-1.el7.x86_64.rpm
mysql-community-test-5.7.21-1.el7.x86_64.rpm
mysql-community-devel-5.7.21-1.el7.x86_64.rpm
mysql-community-libs-5.7.21-1.el7.x86_64.rpm
3、全部安装,出现如下的报错
[root@seiang software]# rpm -ivh *.rpm
warning: mysql-community-client-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
mariadb-libs is obsoleted by mysql-community-libs-5.7.21-1.el7.x86_64
mariadb-libs is obsoleted by mysql-community-libs-compat-5.7.21-1.el7.x86_64
perl(Data::Dumper) is needed by mysql-community-test-5.7.21-1.el7.x86_64
perl(JSON) is needed by mysql-community-test-5.7.21-1.el7.x86_64
4、如上的报错,由于centos 7默认是mariadb数据库,再去安装mysql之前要先下载mariadb
[root@seiang software]# rpm -qa | grep mariadb
mariadb-libs-5.5.41-2.el7_0.x86_64
[root@seiang software]# rpm -e mariadb-libs-5.5.41-2.el7_0.x86_64
error: Failed dependencies:
libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
由于存在依赖关系,强制卸载
[root@seiang software]# rpm -e --nodeps mariadb-libs-5.5.41-2.el7_0.x86_64
5、安装mysql-server,出现报错
[root@seiang software]# rpm -ivh mysql-community-server-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
mysql-community-client(x86-64) >= 5.7.9 is needed by mysql-community-server-5.7.21-1.el7.x86_64
mysql-community-common(x86-64) = 5.7.21-1.el7 is needed by mysql-community-server-5.7.21-1.el7.x86_64
6、根据提示,要先安装mysql-community-common和mysql-community-client包
[root@seiang software]# rpm -ivh mysql-community-common-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-common-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-common-5.7.21-1.e################################# [100%]
7、安装mysql-client包,出现如下的报错
[root@seiang software]# rpm -ivh mysql-community-client-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-client-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
mysql-community-libs(x86-64) >= 5.7.9 is needed by mysql-community-client-5.7.21-1.el7.x86_64
8、根据提示先安装 mysql-community-libs包
[root@seiang software]# rpm -ivh mysql-community-libs-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-libs-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-5.7.21-1.el7################################# [100%]
9、再次尝试安装mysql-client
[root@seiang software]# rpm -ivh mysql-community-client-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-client-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-client-5.7.21-1.e################################# [100%]
10、最后安装mysql-server
[root@seiang software]# rpm -ivh mysql-community-server-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-server-5.7.21-1.e################################# [100%]
11、查看mysql的服务
[root@seiang software]# systemctl status mysqld.service
mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
Active: inactive (dead)
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
12、启动mysql服务
[root@seiang software]# systemctl start mysqld.service
[root@seiang software]#
[root@seiang software]# systemctl status mysqld.service
mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
Active: active (running) since Mon 2018-03-26 09:26:04 CST; 2s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 2113 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
Process: 2034 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 2116 (mysqld)
CGroup: /system.slice/mysqld.service
鈹斺攢2116 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
Mar 26 09:25:54 seiang systemd[1]: Starting MySQL Server...
Mar 26 09:26:04 seiang systemd[1]: Started MySQL Server.
13、mysql服务启动成功,首先使用临时的密码进行登录,查看临时密码
[root@seiang software]# grep "password" /var/log/mysqld.log
2018-03-25T11:18:09.770923Z 1 [Note] A temporary password is generated for root@localhost: &)2KIh?M3hr7
2018-03-25T11:19:39.853663Z 2 [Note] Access denied for user 'root'@'localhost' (using password: YES)
2018-03-25T11:22:20.996230Z 3 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2018-03-25T11:24:31.219087Z 0 [Note] Shutting down plugin 'validate_password'
2018-03-25T11:24:33.062278Z 0 [Note] Shutting down plugin 'sha256_password'
2018-03-25T11:24:33.062286Z 0 [Note] Shutting down plugin 'mysql_native_password'
2018-03-26T01:25:57.938742Z 1 [Note] A temporary password is generated for root@localhost: v,esvf2?oj?T
14、使用临时密码登录,然后修改root的密码
[root@seiang software]# mysql -uroot -pv,esvf2?oj?T
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.21
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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'beijing';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'qcloud@2018';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
两次修改都提示相同的错误:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
下面是官方文档,对于该问题的解释:
https://dev.mysql.com/doc/refman/5.7/en/validate-password.html
上述报错的原因:其实与validate_password_policy的值有关。
validate_password_policy有以下取值:
默认是1,即MEDIUM,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。
解决方法:
修改validate_password_policy参数的值
mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)
mysql> select @@validate_password_length;
+----------------------------+
| @@validate_password_length |
+----------------------------+
| 8 |
+----------------------------+
1 row in set (0.05 sec)
默认的密码长度是8,少于8位依旧会出现报错
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'beijing';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
修改成功
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'qcloud@2018';
Query OK, 0 rows affected (0.00 sec)
15、使用新密码再次登录,登录成功
[root@seiang software]# mysql -uroot -pqcloud@2018
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.21 MySQL Community Server (GPL)
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>
16、由于习惯于Linux的提示,所以我们为mysql也设置提示
(1)临时设置
mysql> prompt \u@ \h \d >
root@ localhost (none) >
root@ localhost (none) >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
root@ localhost mysql >prompt \u@\h [\d]>
PROMPT set to '\u@\h [\d]>'
root@localhost [mysql]>
root@localhost [mysql]>
(2)永久设置
[root@seiang ~]# vim /etc/my.cnf
添加下面两句,注意:[]中是mysql,不是mysqld
[mysql]
prompt=\u@\h [\d]>
Centos7.3离线(rpm方式)安装mysql服务的更多相关文章
- CentOS7下通过rpm方式安装MySQL及插入中文问题解决 [原创]
一 CentOS下通过rpm方式安装MySQL CentOS版本:CentOS-7 MySQL版本:MySQL-5.6.22 在网上搜了一下,Linux下安装MYSQL有三种方式: 1) 通过yum命 ...
- 关于centos7中使用rpm方式安装mysql5.7版本后无法使用root登录的问题
最近在centos7中通过rpm方式安装了最新版本的mysql-server 5.7 (mysql57-community-release-el7-7.noarch.rpm) ,发现安装成功后无法使用 ...
- CentOS7系统使用rpm方式安装MySQL5.7
参考:https://blog.csdn.net/wudinaniya/article/details/81094578 1.首先去mysql官网下载rpm包,一个是server包一个是client包 ...
- centos7上以RPM方式安装MySQL5.6
1. 下载MySQL http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.6/ MySQL-5.6.36-1.el7.src.rpm MySQL-5.6.36- ...
- Centos7下安装包方式安装MySQL
安装包下载地址:https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar 第一步:在 /h ...
- rpm方式安装mysql
一.系统标准化采样 1)查看centos系统版本 [root@fp-web-126 ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 ...
- linux rpm方式安装mysql
01.搜索 mysql linux 网盘地址 http://pan.baidu.com/s/1qYOC6cs 02.把下载好的mysql 使用 xftp传到 linux中 software 文件 ...
- centos7使用rpm方式安装mysql
https://blog.csdn.net/smiles13/article/details/81460617 (部分参考) 先查看是否安装mariadb rpm -qa | grep mari ...
- linux(centos6.9)下rpm方式安装mysql后mysql服务无法启动
以下两种方式启动都报错:启动失败: [root@node03 ~]# service mysqld startMySQL Daemon failed to start.Starting mysqld: ...
随机推荐
- java正则表达式验证金额
String reg_money = "\\d+(\\.\\d{1,2})?";// 金额正则,可以没有小数,小数最多不超过两位 Pattern pattern = Pattern ...
- 二十二、Hadoop学记笔记————Kafka 基础实战 :消费者和生产者实例
kafka的客户端也支持其他语言,这里主要介绍python和java的实现,这两门语言比较主流和热门 图中有四个分区,每个图形对应一个consumer,任意一对一即可 获取topic的分区数,每个分区 ...
- 获取GRIDVIEW中的TemplateField显示的文本值
GRIDVIEW中数据源绑定后的属性绑定我一般采取2种办法 一个是BoundField,只要设置DataField的对应属性名即可: 如: <asp:BoundField HeaderText ...
- 整合 ucenter 注册自动激活
http://my.oschina.net/banbo/blog/311691 应用整合 UCenter,同步注册到 Discuz 的用户,在 Discuz 登录时得手动激活,用户体验很不好,不过解决 ...
- 译MassTransit 创建消息消费者
创建消息消费者一个消息消费者是一个 可以消费一个或多个消息类型的类,指定IConsumer<T>接口,T为消息类型 public class UpdateCustomerConsumer ...
- 大话RabbitMQ 基础入门
----------写在前面---------- 近些年微服务越来越火,让我也忍不住想去一窥微服务究竟,讲到微服务,就离不开分布式,而分布式,也离不开消息队列,在消息队列中,RabbitMQ可以说是比 ...
- 电脑开机失败提示"用户配置文件服务登录失败"的三种解决办法
最近遇到这样一个怪现象,就是每次打开电脑输入密码,突然提示"User Profile Service 服务未能登录,无法加载用户配置文件",然后就没办法正常开机了,为什么会这样呢? ...
- Semaphore简介
Semaphore简介 Semaphore是并发包中提供的用于控制某资源同时被访问的个数 操作系统的信号量是个很重要的概念,在进程控制方面都有应用.Java 并发库 的Semaphore 可以很轻松完 ...
- 【bzoj2432】【NOI2011】兔农
题目描述 农夫栋栋近年收入不景气,正在他发愁如何能多赚点钱时,他听到隔壁的小 朋友在讨论兔子繁殖的问题. 问题是这样的:第一个月初有一对刚出生的小兔子,经过两个月长大后,这 对兔子从第三个月开始,每个 ...
- BZOJ_4325_NOIP2015 斗地主_DFS
BZOJ_4325_NOIP2015 斗地主_DFS Description 牛牛最近迷上了一种叫斗地主的扑克游戏.斗地主是一种使用黑桃.红心.梅花.方片的A到K加上大小王的共54张牌来进行的扑克牌游 ...