快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

CentOS7.4怎么用rpm包安装mysql5.7.17

本篇内容介绍了“CentOS7.4怎么用rpm包安装MySQL5.7.17”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

创新互联是网站建设专家,致力于互联网品牌建设与网络营销,专业领域包括成都做网站、网站建设、电商网站制作开发、小程序开发、微信营销、系统平台开发,与其他网站设计及系统开发公司不同,我们的整合解决方案结合了恒基网络品牌建设经验和互联网整合营销的理念,并将策略和执行紧密结合,且不断评估并优化我们的方案,为客户提供全方位的互联网品牌整合方案!

操作系统环境:

  1. CentOS Linux release 7.4.1708 (Core)

MySQL版本:5.7.17

一,卸载mariadb-lib

  1. [root@iZ2ze6jo3o3bqbcongnypqZ lib]# rpm -qa|grep mariadb

  2. mariadb-libs-5.5.56-2.el7.x86_64 

  3. [root@iZ2ze6jo3o3bqbcongnypqZ ~]# yum -y remove mariadb-libs-5.5.56-2.el7.x86_64

  4. Loaded plugins: fastestmirror

  5. Resolving Dependencies

  6. --> Running transaction check

  7. ---> Package mariadb-libs.x86_64 1:5.5.56-2.el7 will be erased

  8. --> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64

  9. --> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64

  10. --> Running transaction check

  11. ---> Package postfix.x86_64 2:2.10.1-6.el7 will be erased

  12. --> Processing Dependency: /usr/sbin/sendmail for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64

  13. --> Restarting Dependency Resolution with new changes.

  14. --> Running transaction check

  15. ---> Package redhat-lsb-core.x86_64 0:4.1-27.el7.centos.1 will be erased

  16. --> Finished Dependency Resolution

  17. Dependencies Resolved

  18. ==============================================================================================================================================================================================================================================================================

  19.  Package Arch Version Repository Size

  20. ==============================================================================================================================================================================================================================================================================

  21. Removing:

  22.  mariadb-libs x86_64 1:5.5.56-2.el7 @base 4.4 M

  23. Removing for dependencies:

  24.  postfix x86_64 2:2.10.1-6.el7 @anaconda 12 M

  25.  redhat-lsb-core x86_64 4.1-27.el7.centos.1 @base 45 k

  26. Transaction Summary

  27. ==============================================================================================================================================================================================================================================================================

  28. Remove 1 Package (+2 Dependent packages)

  29. Installed size: 17 M

  30. Downloading packages:

  31. Running transaction check

  32. Running transaction test

  33. Transaction test succeeded

  34. Running transaction

  35.   Erasing : redhat-lsb-core-4.1-27.el7.centos.1.x86_64 1/3 

  36.   Erasing : 2:postfix-2.10.1-6.el7.x86_64 2/3 

  37.   Erasing : 1:mariadb-libs-5.5.56-2.el7.x86_64 3/3 

  38.   Verifying : 1:mariadb-libs-5.5.56-2.el7.x86_64 1/3 

  39.   Verifying : 2:postfix-2.10.1-6.el7.x86_64 2/3 

  40.   Verifying : redhat-lsb-core-4.1-27.el7.centos.1.x86_64 3/3 

  41. Removed:

  42.   mariadb-libs.x86_64 1:5.5.56-2.el7 

  43. Dependency Removed:

  44.   postfix.x86_64 2:2.10.1-6.el7 redhat-lsb-core.x86_64 0:4.1-27.el7.centos.1 

  45. Complete!

undefined


二,下载mysql5.7.17rpm安装包,具体是mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar

  1. wget https://downloads.mysql.com/archives/get/file/mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar

三,解压


  1. [root@iZ2ze6jo3o3bqbcongnyppZ ~]# tar -xvf mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar


  1. -rw-r--r-- 1 7155 31415 25037548 Nov 30 2016 mysql-community-client-5.7.17-1.el7.x86_64.rpm

  2. -rw-r--r-- 1 7155 31415 277812 Nov 30 2016 mysql-community-common-5.7.17-1.el7.x86_64.rpm

  3. -rw-r--r-- 1 7155 31415 3774276 Nov 30 2016 mysql-community-devel-5.7.17-1.el7.x86_64.rpm

  4. -rw-r--r-- 1 7155 31415 45474744 Nov 30 2016 mysql-community-embedded-5.7.17-1.el7.x86_64.rpm

  5. -rw-r--r-- 1 7155 31415 23925668 Nov 30 2016 mysql-community-embedded-compat-5.7.17-1.el7.x86_64.rpm

  6. -rw-r--r-- 1 7155 31415 126047424 Nov 30 2016 mysql-community-embedded-devel-5.7.17-1.el7.x86_64.rpm

  7. -rw-r--r-- 1 7155 31415 2237116 Nov 30 2016 mysql-community-libs-5.7.17-1.el7.x86_64.rpm

  8. -rw-r--r-- 1 7155 31415 2112724 Nov 30 2016 mysql-community-libs-compat-5.7.17-1.el7.x86_64.rpm

  9. -rw-r--r-- 1 7155 31415 54571580 Nov 30 2016 mysql-community-minimal-debuginfo-5.7.17-1.el7.x86_64.rpm

  10. -rw-r--r-- 1 7155 31415 169496800 Nov 30 2016 mysql-community-server-5.7.17-1.el7.x86_64.rpm

  11. -rw-r--r-- 1 7155 31415 14478292 Nov 30 2016 mysql-community-server-minimal-5.7.17-1.el7.x86_64.rpm

  12. -rw-r--r-- 1 7155 31415 116682212 Nov 30 2016 mysql-community-test-5.7.17-1.el7.x86_64.rpm

四,安装

要按照如下顺序安装

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

  2. [root@iZ2ze6jo3o3bqbcongnyppZ ~]# rpm -ivh mysql-community-libs-5.7.17-1.el7.x86_64.rpm

  3. [root@iZ2ze6jo3o3bqbcongnyppZ ~]# rpm -ivh mysql-community-libs-compat-5.7.17-1.el7.x86_64

  4. [root@iZ2ze6jo3o3bqbcongnyppZ ~]# rpm -ivh mysql-community-devel-5.7.17-1.el7.x86_64

  5. [root@iZ2ze6jo3o3bqbcongnyppZ ~]# rpm -ivh mysql-community-client-5.7.17-1.el7.x86_64.rpm

  6. [root@iZ2ze6jo3o3bqbcongnyppZ ~]# rpm -ivh mysql-community-server-5.7.17-1.el7.x86_64.rpm

在安装server的时候报错


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

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

  3. error: Failed dependencies:

  4.     libaio.so.1()(64bit) is needed by mysql-community-server-5.7.17-1.el7.x86_64

  5.     libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-5.7.17-1.el7.x86_64

  6.     libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-5.7.17-1.el7.x86_64


缺少libaio.so,用yum安装上:


  1. [root@iZ2ze6jo3o3bqbcongnypoZ ~]# yum install libaio*

  2. Loaded plugins: fastestmirror

  3. Loading mirror speeds from cached hostfile

  4.  * base: mirrors.cloud.aliyuncs.com

  5.  * epel: mirrors.cloud.aliyuncs.com

  6.  * extras: mirrors.cloud.aliyuncs.com

  7.  * updates: mirrors.cloud.aliyuncs.com

  8. Resolving Dependencies

  9. --> Running transaction check

  10. ---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed

  11. ---> Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed

  12. --> Finished Dependency Resolution

  13. Dependencies Resolved

  14. ==============================================================================================================================================================================================================================================================================

  15.  Package Arch Version Repository Size

  16. ==============================================================================================================================================================================================================================================================================

  17. Installing:

  18.  libaio x86_64 0.3.109-13.el7 base 24 k

  19.  libaio-devel x86_64 0.3.109-13.el7 base 13 k

  20. Transaction Summary

  21. ==============================================================================================================================================================================================================================================================================

  22. Install 2 Packages

  23. Total download size: 37 k

  24. Installed size: 46 k

  25. Is this ok [y/d/N]: y

  26. Downloading packages:

  27. (1/2): libaio-0.3.109-13.el7.x86_64.rpm | 24 kB 00:00:00 

  28. (2/2): libaio-devel-0.3.109-13.el7.x86_64.rpm | 13 kB 00:00:00 

  29. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

  30. Total 243 kB/s | 37 kB 00:00:00 

  31. Running transaction check

  32. Running transaction test

  33. Transaction test succeeded

  34. Running transaction

  35. Warning: RPMDB altered outside of yum.

  36.   Installing : libaio-0.3.109-13.el7.x86_64 1/2 

  37.   Installing : libaio-devel-0.3.109-13.el7.x86_64 2/2 

  38.   Verifying : libaio-0.3.109-13.el7.x86_64 1/2 

  39.   Verifying : libaio-devel-0.3.109-13.el7.x86_64 2/2 

  40. Installed:

  41.   libaio.x86_64 0:0.3.109-13.el7 libaio-devel.x86_64 0:0.3.109-13.el7 

  42. Complete!


五,找到密码:


找到数据库的初始密码,最后一行冒号后面的就是

  1. [root@iZ2ze6jo3o3bqbcongnypqZ mysql]# cat /var/log/mysqld.log 

  2. 2017-11-03T08:41:25.257336Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

  3. 2017-11-03T08:41:26.329912Z 0 [Warning] InnoDB: New log files created, LSN=45790

  4. 2017-11-03T08:41:26.543807Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

  5. 2017-11-03T08:41:26.566468Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: c79a2e4b-c072-11e7-b809-00163e0ad76e.

  6. 2017-11-03T08:41:26.570349Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

  7. 2017-11-03T08:41:26.571065Z 1 [Note] A temporary password is generated for root@localhost: 7PkQ:l


六,启动mysql


  1. [root@iZ2ze6jo3o3bqbcongnyppZ ~]# systemctl start mysqld.service

  2. [root@iZ2ze6jo3o3bqbcongnyppZ ~]# mysql -uroot -p

  3. Enter password: 

  4. Welcome to the MySQL monitor. Commands end with ; or \g.

  5. Your MySQL connection id is 3

  6. Server version: 5.7.17

  7. Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

  8. Oracle is a registered trademark of Oracle Corporation and/or its

  9. affiliates. Other names may be trademarks of their respective

  10. owners.

  11. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

  12. mysql>

七,修改密码

临时密码过期了,需要修改
  1. mysql> show databases;

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


用如下命令修改

  1. ALTER USER 'root'@'localhost' IDENTIFIED BY 'yournew_password';

“CentOS7.4怎么用rpm包安装mysql5.7.17”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!


文章题目:CentOS7.4怎么用rpm包安装mysql5.7.17
标题路径:http://6mz.cn/article/jeopog.html

其他资讯