CentOS7.4怎么用rpm包安装mysql5.7.17
本篇内容介绍了“CentOS7.4怎么用rpm包安装mysql5.7.17”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
操作系统环境:
CentOS Linux release 7.4.1708(Core)
MySQL版本:5.7.17
一,卸载mariadb-lib
[root@iZ2ze6jo3o3bqbcongnypqZlib]#rpm -qa|grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
[root@iZ2ze6jo3o3bqbcongnypqZ~]#yum -y remove mariadb-libs-5.5.56-2.el7.x86_64
Loaded plugins: fastestmirror
Resolving Dependencies
-->Running transaction check
--->Package mariadb-libs.x86_64 1:5.5.56-2.el7 will be erased
-->Processing Dependency: libmysqlclient.so.18()(64bit)forpackage: 2:postfix-2.10.1-6.el7.x86_64
-->Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit)forpackage: 2:postfix-2.10.1-6.el7.x86_64
-->Running transaction check
--->Package postfix.x86_64 2:2.10.1-6.el7 will be erased
-->Processing Dependency:/usr/sbin/sendmailforpackage: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
-->Restarting Dependency Resolution with new changes.
-->Running transaction check
--->Package redhat-lsb-core.x86_64 0:4.1-27.el7.centos.1 will be erased
-->Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================================================================================================================================
Package ArchVersionRepository Size
==============================================================================================================================================================================================================================================================================
Removing:
mariadb-libs x86_64 1:5.5.56-2.el7@base4.4 M
Removingfordependencies:
postfix x86_64 2:2.10.1-6.el7@anaconda12 M
redhat-lsb-core x86_64 4.1-27.el7.centos.1@base45 k
Transaction Summary
==============================================================================================================================================================================================================================================================================
Remove 1 Package(+2 Dependent packages)
Installed size: 17 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : redhat-lsb-core-4.1-27.el7.centos.1.x86_64 1/3
Erasing : 2:postfix-2.10.1-6.el7.x86_64 2/3
Erasing : 1:mariadb-libs-5.5.56-2.el7.x86_64 3/3
Verifying : 1:mariadb-libs-5.5.56-2.el7.x86_64 1/3
Verifying : 2:postfix-2.10.1-6.el7.x86_64 2/3
Verifying : redhat-lsb-core-4.1-27.el7.centos.1.x86_64 3/3
Removed:
mariadb-libs.x86_64 1:5.5.56-2.el7
Dependency Removed:
postfix.x86_64 2:2.10.1-6.el7 redhat-lsb-core.x86_64 0:4.1-27.el7.centos.1
Complete!
undefined
二,下载mysql5.7.17rpm安装包,具体是mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar
wget https://downloads.mysql.com/archives/get/file/mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar
三,解压
[root@iZ2ze6jo3o3bqbcongnyppZ~]#tar -xvf mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar
-rw-r--r-- 1 7155 31415 25037548 Nov 30 2016 mysql-community-client-5.7.17-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 277812 Nov 30 2016 mysql-community-common-5.7.17-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 3774276 Nov 30 2016 mysql-community-devel-5.7.17-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 45474744 Nov 30 2016 mysql-community-embedded-5.7.17-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 23925668 Nov 30 2016 mysql-community-embedded-compat-5.7.17-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 126047424 Nov 30 2016 mysql-community-embedded-devel-5.7.17-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 2237116 Nov 30 2016 mysql-community-libs-5.7.17-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 2112724 Nov 30 2016 mysql-community-libs-compat-5.7.17-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 54571580 Nov 30 2016 mysql-community-minimal-debuginfo-5.7.17-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 169496800 Nov 30 2016 mysql-community-server-5.7.17-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 14478292 Nov 30 2016 mysql-community-server-minimal-5.7.17-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 116682212 Nov 30 2016 mysql-community-test-5.7.17-1.el7.x86_64.rpm
四,安装要按照如下顺序安装
[root@iZ2ze6jo3o3bqbcongnyppZ~]#rpm-ivh mysql-community-common-5.7.17-1.el7.x86_64.rpm
[root@iZ2ze6jo3o3bqbcongnyppZ~]#rpm-ivh mysql-community-libs-5.7.17-1.el7.x86_64.rpm
[root@iZ2ze6jo3o3bqbcongnyppZ ~]# rpm -ivh mysql-community-libs-compat-5.7.17-1.el7.x86_64
[root@iZ2ze6jo3o3bqbcongnyppZ ~]# rpm -ivh mysql-community-devel-5.7.17-1.el7.x86_64
[root@iZ2ze6jo3o3bqbcongnyppZ~]#rpm-ivh mysql-community-client-5.7.17-1.el7.x86_64.rpm
[root@iZ2ze6jo3o3bqbcongnyppZ~]#rpm-ivh mysql-community-server-5.7.17-1.el7.x86_64.rpm
在安装server的时候报错[root@iZ2ze6jo3o3bqbcongnypoZ~]#rpm -ivh mysql-community-server-5.7.17-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.17-1.el7.x86_64.rpm: Header V3 DSA/SHA1Signature,key ID 5072e1f5: NOKEY
error: Failed dependencies:
libaio.so.1()(64bit)isneeded by mysql-community-server-5.7.17-1.el7.x86_64
libaio.so.1(LIBAIO_0.1)(64bit)isneeded by mysql-community-server-5.7.17-1.el7.x86_64
libaio.so.1(LIBAIO_0.4)(64bit)isneeded by mysql-community-server-5.7.17-1.el7.x86_64
缺少libaio.so,用yum安装上:
[root@iZ2ze6jo3o3bqbcongnypoZ~]#yum install libaio*
Loaded plugins: fastestmirror
Loading mirror speedsfromcached hostfile
*base: mirrors.cloud.aliyuncs.com
*epel: mirrors.cloud.aliyuncs.com
*extras: mirrors.cloud.aliyuncs.com
*updates: mirrors.cloud.aliyuncs.com
Resolving Dependencies
-->Running transaction check
--->Package libaio.x86_64 0:0.3.109-13.el7 will be installed
--->Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed
-->Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================================================================================================================================
Package ArchVersionRepository Size
==============================================================================================================================================================================================================================================================================
Installing:
libaio x86_64 0.3.109-13.el7 base 24 k
libaio-devel x86_64 0.3.109-13.el7 base 13 k
Transaction Summary
==============================================================================================================================================================================================================================================================================
Install 2 Packages
Total download size: 37 k
Installed size: 46 k
Isthis ok[y/d/N]:y
Downloading packages:
(1/2):libaio-0.3.109-13.el7.x86_64.rpm|24 kB 00:00:00
(2/2):libaio-devel-0.3.109-13.el7.x86_64.rpm|13 kB 00:00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 243 kB/s|37 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : libaio-0.3.109-13.el7.x86_64 1/2
Installing : libaio-devel-0.3.109-13.el7.x86_64 2/2
Verifying : libaio-0.3.109-13.el7.x86_64 1/2
Verifying : libaio-devel-0.3.109-13.el7.x86_64 2/2
Installed:
libaio.x86_64 0:0.3.109-13.el7 libaio-devel.x86_64 0:0.3.109-13.el7
Complete!
五,找到密码:
找到数据库的初始密码,最后一行冒号后面的就是
[root@iZ2ze6jo3o3bqbcongnypqZmysql]#cat/var/log/mysqld.log
2017-11-03T08:41:25.257336Z 0[Warning]TIMESTAMPwith implicitDEFAULTvalueisdeprecated.Please use --explicit_defaults_for_timestamp server option(see documentationformore details).
2017-11-03T08:41:26.329912Z 0[Warning]InnoDB: Newlogfiles created,LSN=45790
2017-11-03T08:41:26.543807Z 0[Warning]InnoDB: Creating foreign key constraint system tables.
2017-11-03T08:41:26.566468Z 0[Warning]No existingUUIDhas been found,so we assume that thisisthefirsttimethat this server has been started.Generating a newUUID:c79a2e4b-c072-11e7-b809-00163e0ad76e.
2017-11-03T08:41:26.570349Z 0[Warning]Gtidtableisnotreadytobe used.Table'mysql.gtid_executed'cannot be opened.
2017-11-03T08:41:26.571065Z 1[Note]A temporarypasswordisgeneratedforroot@localhost:7PkQ:l<p2cpH
六,启动mysql
[root@iZ2ze6jo3o3bqbcongnyppZ~]#systemctl start mysqld.service
[root@iZ2ze6jo3o3bqbcongnyppZ~]#mysql -uroot -p
Enterpassword:
Welcometothe MySQL monitor.Commandsendwith;or\g.
Your MySQL connection idis3
Serverversion:5.7.17
Copyright(c)2000,2016,Oracleand/orits affiliates.All rights reserved.
Oracleisa registered trademark of Oracle Corporationand/orits
affiliates.Other names may be trademarks of their respective
owners.
Type'help;'or'\h'forhelp.Type'\c'toclear the current input statement.
mysql>
七,修改密码临时密码过期了,需要修改
mysql>showdatabases;
ERROR 1820(HY000):You mustresetyourpasswordusing ALTERUSERstatement before executing this statement.
用如下命令修改
ALTERUSER'root'@'localhost'IDENTIFIED BY'yournew_password';
“CentOS7.4怎么用rpm包安装mysql5.7.17”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。