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

下面是官方文档,对于该问题的解释:

上述报错的原因:其实与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]>

安装mysql数据库出现问题_安装mysql数据库及问题解决方法相关推荐

  1. 数据库创建函数_达梦数据库创建UUID函数

    数据库创建函数_达梦数据库创建UUID函数 接触达梦数据库有一段时间了,整理了一些资料,今天分享一下达梦数据UUID自定义函数 UUID函数定义 很多数据库都有提供UUID函数,可是接触达梦数据库后, ...

  2. mysql数据库连接配置路径_[zz]MySQL数据库主从同步安装与配置总结

    注意:本文出自"阿飞"的博客 ,如果要转载本文章,请与作者联系! 并注明来源: http://blog.sina.com.cn/s/blog_49fd52cf0100pog2.ht ...

  3. mysql数据库连接配置路径_关于mysql安装后更改数据库路径方法-linux环境

    使用yum安装mysql后,数据库路径一般和日志文件放在一个分区/var路径下. 久后,随着日志文件的增加,数据库的存放大小会显得不足,因此,建议安装mysql后将数据库路径更改到一个更加合理的分区存 ...

  4. mysql服务remove失败_《MySQL数据库》MySql简介、下载与安装

    一.MySQL的简介 MySQL,是一个关系型数据库管理系统,它是由瑞典MySQL AB公司开发的产品,之后被Sun公司收购:在2009年4月20日,Sun公司被Oracle公司收购:从此MySQl属 ...

  5. mysql user表 空_安装mysql发现mysql对应的数据库user表内容是空的

    安装mysql发现mysql对应的数据库user表内容是空的: 所以在使用root登录始终都不能成功. 后来查看了一下日志发现: [root@n1 mysql]# mysql_install_db - ...

  6. 阿里云mysql服务器太贵_阿里云数据库,跟自己在服务器安装的有什么区别?有人说安装很简单,那为什么要花钱买?...

    网友解答: 这个问题本质上就是私有云与公有云的区别.私有云所有的事情都是自己操心,自己采购.自己部署.自己运维,换来的是自己对IT的100%的控制.而公有云很多工作交给了服务商,没有采购的环境.没有运 ...

  7. mysql pmm 布署_给 mysql 安装 pmm 监控

    PMM 说明 PMM(Percona Monitoring and Management) 是一款监控和分析 MySQL 服务的一套工具,可以从图形化的方式看到 MySQL 服务的各种性能指标,慢查询 ...

  8. mysql starting server 失败_安装MySQL过程中(最后starting server)报错解决方案

    错误显示: 点击取消,直至安装结束后,去C:\ProgramData\MySQL\MySQL Server 5.6\data下面的.err文件看看,用记事本打开,内容是否类似于: 150318 10: ...

  9. mysql数据库建仓范式_存mysql个数

    MySQL学习笔记之数据类型详解 注:以下内容针对MySQL5.0及以上版本 MySQL的数据类型非常多,选择正确的数据类型对于获得高性能至关重要,本文是我结合网上看到的一些blog加上<高性能 ...

  10. mysql数据库的目录_了解MySQl数据库目录

    数据库目录是MySQL数据库服务器存放数据文件的地方,不仅包括有关表的文件,还包括数据文件和MySQL的服务器选项文件.不同的分发,数据库目录的缺省位置是不同的. 数据目录的位置 缺省的数据库位置 缺 ...

最新文章

  1. 《告别失控:软件开发团队管理必读》一一2.6 代系特点
  2. Python NumPy-快速处理数据
  3. @ConfigurationProperties 注解
  4. php类型优先级_PHP: 运算符优先级 - Manual
  5. 如何调整金格电子章服务器印章_如何利用OA系统进行电子公章、红头文件及打印的管理...
  6. 基于读取车载RFID标签自动开关车库门c#算法实现
  7. PostgreSQL 数组类型
  8. ld: -pie can only be used when targeting iOS 4.2 or later clang: error: linker command failed with e
  9. nmap扫描常用命令详解
  10. [Python] Django+Apache 报 [wsgi:error]问题解决
  11. ./configure,make,make install的作用(转)
  12. 常用的linux文件权限
  13. codeforces 385C Bear and Prime Numbers
  14. 蓝桥杯 ALGO-64 算法训练 大小写判断
  15. 到底谁应该对软件开发的质量负责?
  16. C#编程如何安装Nupkg包
  17. 打印系统开发(5)——书脊
  18. java 语音传输_java – 通过tcp流式传输语音
  19. openffice安装(windows和linux)
  20. python进程已结束,退出代码 -1073740791 (0xC0000409)解决办法

热门文章

  1. php 在线调用音乐播放器,使用HTML5实现网页音乐播放器
  2. html模板查询,前台模板查找
  3. 搭建OA系统运维需要了解的知识?
  4. 2020-11-11抖音去水印解析获取源标题、作者、头像、封面图以及源视频地址
  5. 如何自学计算机access,我是怎样自学access的
  6. 电脑时间显示到秒 设置电脑显示时间为秒
  7. xp关闭计算机共享,关闭Windows XP系统默认共享四种方法
  8. XML的三大解析方式解析
  9. android 5.0判断服务是否开启中,android5.0之后版本服务出现的显示问题解决方案
  10. 《财富》2022全球500强榜单,沃尔玛九连冠,沙特阿美最赚钱,中国公司上榜最多 | 美通社头条...