CentOs7.4安装Mysql5.7

一.下载安装包

目录

一.下载安装包

1.1官网下载

1.2选择好版本

1.3下载rpm包

二.开始安装

2.1按上面顺序安装rpm包

2.2启动mysql服务

2.3登陆修改密码

三.遇到的问题


 

1.1官网下载

https://dev.mysql.com/downloads/mysql/

1.2选择好版本

 

 

1.3下载rpm包

 

mysql-community-common-5.7.22-1.el7.x86_64.rpm

mysql-community-libs-5.7.22-1.el7.x86_64.rpm

mysql-community-client-5.7.22-1.el7.x86_64.rpm

mysql-community-server-5.7.22-1.el7.x86_64.rpm

下载这4个包即可,如需要其他工具请自行下载安装

 

二.开始安装

2.1按上面顺序安装rpm包

[root@py ~]# rpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpm

[root@py ~]# rpm -ivh mysql-community-libs-5.7.22-1.el7.x86_64.rpm

[root@py ~]# rpm -ivh mysql-community-client-5.7.22-1.el7.x86_64.rpm

[root@py ~]# rpm -ivh mysql-community-server-5.7.22-1.el7.x86_64.rpm

 

2.2启动mysql服务

 

[root@py ~]# service mysqld start

Redirecting to /bin/systemctl start mysqld.service

 

2.3登陆修改密码

启动后系统自动生成一个密码存储在/var/log/mysqld.log

[root@py ~]# grep password /var/log/mysqld.log 

2018-07-18T10:42:45.283629Z 1 [Note] A temporary password is generated for root@localhost: 6q33PelhRK?v

 

[root@py ~]# mysql -uroot -p6q33PelhRK?v

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 6

Server version: 5.7.22

 

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> show databases;

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

意思是需要修改密码

mysql> alter user 'root'@'localhost' identified by 'Qwe@wy.123';

 

三.遇到的问题

[root@py ~]# rpm -ivh mysql-community-libs-5.7.22-1.el7.x86_64.rpm

warning: mysql-community-libs-5.7.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

error: Failed dependencies:

mysql-community-common(x86-64) >= 5.7.9 is needed by mysql-community-libs-5.7.22-1.el7.x86_64

mariadb-libs is obsoleted by mysql-community-libs-5.7.22-1.el7.x86_64

 

第二行centos7自带mariadb与mysql冲突,卸载mariadb即可。第一行由于冲突mysql-community-common没有安装成功,卸载mariadb后重新安装即可。

[root@py ~]# rpm -qa |grep mariadb

mariadb-libs-5.5.56-2.el7.x86_64

 

[root@py ~]# rpm -e mariadb-libs-5.5.56-2.el7.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@py ~]# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

黑洞鱼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值