一.下载安装包
目录
一.下载安装包
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-ivhmysql-community-common-5.7.22-1.el7.x86_64.rpm
[root@py~]#rpm-ivhmysql-community-libs-5.7.22-1.el7.x86_64.rpm
[root@py~]#rpm-ivhmysql-community-client-5.7.22-1.el7.x86_64.rpm
[root@py~]#rpm-ivhmysql-community-server-5.7.22-1.el7.x86_64.rpm
2.2启动mysql服务
[root@py~]#servicemysqldstart
Redirectingto/bin/systemctlstartmysqld.service
2.3登陆修改密码
启动后系统自动生成一个密码存储在/var/log/mysqld.log
[root@py~]#greppassword/var/log/mysqld.log
2018-07-18T10:42:45.283629Z1[Note]Atemporarypasswordisgeneratedforroot@localhost:6q33PelhRKv
[root@py~]#mysql-uroot-p6q33PelhRKv
mysql:[Warning]Usingapasswordonthecommandlineinterfacecanbeinsecure.
WelcometotheMySQLmonitor.Commandsendwith;or\g.
YourMySQLconnectionidis6
Serverversion:5.7.22
Copyright(c)2000,2018,Oracleand/oritsaffiliates.Allrightsreserved.
OracleisaregisteredtrademarkofOracleCorporationand/orits
affiliates.Othernamesmaybetrademarksoftheirrespective
owners.
Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.
mysql>
成功登陆
mysql>showdatabases;
ERROR1820(HY000):YoumustresetyourpasswordusingALTERUSERstatementbeforeexecutingthisstatement.
意思是需要修改密码
mysql>alteruser'root'@'localhost'identifiedby'Qwe@wy.123';
三.遇到的问题
[root@py~]#rpm-ivhmysql-community-libs-5.7.22-1.el7.x86_64.rpm
warning:mysql-community-libs-5.7.22-1.el7.x86_64.rpm:HeaderV3DSA/SHA1Signature,keyID5072e1f5:NOKEY
error:Faileddependencies:
mysql-community-common(x86-64)>=5.7.9isneededbymysql-community-libs-5.7.22-1.el7.x86_64
mariadb-libsisobsoletedbymysql-community-libs-5.7.22-1.el7.x86_64
第二行centos7自带mariadb与mysql冲突,卸载mariadb即可。第一行由于冲突mysql-community-common没有安装成功,卸载mariadb后重新安装即可。
[root@py~]#rpm-qa|grepmariadb
mariadb-libs-5.5.56-2.el7.x86_64
[root@py~]#rpm-emariadb-libs-5.5.56-2.el7.x86_64
error:Faileddependencies:
libmysqlclient.so.18()(64bit)isneededby(installed)postfix-2:2.10.1-6.el7.x86_64
libmysqlclient.so.18(libmysqlclient_18)(64bit)isneededby(installed)postfix-2:2.10.1-6.el7.x86_64
强行卸载
[root@py~]#rpm-e--nodepsmariadb-libs-5.5.56-2.el7.x86_64