温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如何使用yum方式安装mysql5.7 on linux_64

发布时间:2021-11-01 16:09:24 来源:亿速云 阅读:132 作者:小新 栏目:MySQL数据库

这篇文章主要介绍了如何使用yum方式安装mysql5.7 on linux_64,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

1.下载并安装RPM
https://dev.mysql.com/downloads/repo/yum/
rpm -ivh mysql57-community-release-el6-11.noarch.rpm

2.确认安装成功

点击(此处)折叠或打开

  1. # yum repolist enabled | grep "mysql.*-community.*"

  2. This system is not registered with RHN.

  3. RHN support will be disabled.

  4. http://repo.mysql.com/yum/mysql-connectors-community/el/6/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - ""

  5. Trying other mirror.

  6. mysql-connectors-community           MySQL Connectors Community           0

  7. mysql-tools-community                MySQL Tools Community                0

  8. mysql57-community                    MySQL 5.7 Community Server           0

3.选择安装程序
编辑文件/etc/yum.repos.d/mysql-community.repo,将想安装的版本条目enable=1

点击(此处)折叠或打开

  1. [mysql57-community]

  2. name=MySQL 5.7 Community Server

  3. baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/

  4. enabled=0

  5. gpgcheck=1

  6. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

点击(此处)折叠或打开

  1. # yum repolist enabled | grep mysql

  2. This system is not registered with RHN.

  3. RHN support will be disabled.

  4. mysql57-community               MySQL 5.7 Community Server                  237


4.确保连接至internet

点击(此处)折叠或打开

  1. [root@mysql1 network-scripts]# cat ifcfg-eth0

  2. DEVICE="eth0"

  3. HWADDR="00:0C:29:68:EC:D8"

  4. NM_CONTROLLED="yes"

  5. ONBOOT="yes"

  6. BOOTPROTO=none

  7. IPADDR=192.168.1.200

  8. NETMASK=255.255.255.0

  9. GATEWAY=192.168.1.1

  10. [root@mysql1 network-scripts]# cat /etc/resolv.conf

  11. nameserver 114.114.114.114

  12. nameserver 8.8.8.8

  13. nameserver 192.168.0.1

点击(此处)折叠或打开

  1. curl http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/repodata/repomd.xml


5.安装mysql

点击(此处)折叠或打开

  1. # yum install mysql-community-server

  2. Loaded plugins: rhnplugin

  3. This system is not registered with RHN.

  4. RHN support will be disabled.

  5. Setting up Install Process

  6. Resolving Dependencies

  7. --> Running transaction check

  8. ---> Package mysql-community-server.x86_64 0:5.7.21-1.el6 set to be updated

  9. --> Processing Dependency: mysql-community-common(x86-64) = 5.7.21-1.el6 for package: mysql-community-server-5.7.21-1.el6.x86_64

  10. --> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.21-1.el6.x86_64

  11. --> Processing Dependency: perl(strict) for package: mysql-community-server-5.7.21-1.el6.x86_64

  12. --> Processing Dependency: perl(POSIX) for package: mysql-community-server-5.7.21-1.el6.x86_64

  13. --> Processing Dependency: perl(Getopt::Long) for package: mysql-community-server-5.7.21-1.el6.x86_64

  14. --> Processing Dependency: perl(File::Path) for package: mysql-community-server-5.7.21-1.el6.x86_64

  15. --> Processing Dependency: libnuma.so.1(libnuma_1.2)(64bit) for package: mysql-community-server-5.7.21-1.el6.x86_64

  16. --> Processing Dependency: libnuma.so.1(libnuma_1.1)(64bit) for package: mysql-community-server-5.7.21-1.el6.x86_64

  17. --> Processing Dependency: /usr/bin/perl for package: mysql-community-server-5.7.21-1.el6.x86_64

  18. --> Processing Dependency: libnuma.so.1()(64bit) for package: mysql-community-server-5.7.21-1.el6.x86_64

  19. --> Running transaction check

  20. ---> Package mysql-community-client.x86_64 0:5.7.21-1.el6 set to be updated

  21. --> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.21-1.el6.x86_64

  22. ---> Package mysql-community-common.x86_64 0:5.7.21-1.el6 set to be updated

  23. ---> Package numactl.x86_64 0:2.0.3-9.el6 set to be updated

  24. ---> Package perl.x86_64 4:5.10.1-115.el6 set to be updated

  25. --> Processing Dependency: perl-libs = 4:5.10.1-115.el6 for package: 4:perl-5.10.1-115.el6.x86_64

  26. --> Processing Dependency: perl(version) for package: 4:perl-5.10.1-115.el6.x86_64

  27. --> Processing Dependency: perl-libs for package: 4:perl-5.10.1-115.el6.x86_64

  28. --> Processing Dependency: perl(Pod::Simple) for package: 4:perl-5.10.1-115.el6.x86_64

  29. --> Processing Dependency: perl(Module::Pluggable) for package: 4:perl-5.10.1-115.el6.x86_64

  30. --> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.10.1-115.el6.x86_64

  31. --> Running transaction check

  32. ---> Package mysql-community-libs.x86_64 0:5.7.21-1.el6 set to be updated

  33. ---> Package perl-Module-Pluggable.x86_64 1:3.90-115.el6 set to be updated

  34. ---> Package perl-Pod-Simple.x86_64 1:3.13-115.el6 set to be updated

  35. --> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.13-115.el6.x86_64

  36. ---> Package perl-libs.x86_64 4:5.10.1-115.el6 set to be updated

  37. ---> Package perl-version.x86_64 3:0.77-115.el6 set to be updated

  38. --> Running transaction check

  39. ---> Package perl-Pod-Escapes.x86_64 1:1.04-115.el6 set to be updated

  40. --> Finished Dependency Resolution


  41. Dependencies Resolved


  42. ==============================================================================================================================================================================================================================================================================

  43. Package                                                                 Arch                                                    Version                                                             Repository                                                          Size

  44. ==============================================================================================================================================================================================================================================================================

  45. Installing:

  46. mysql-community-server                                                  x86_64                                                  5.7.21-1.el6                                                        mysql57-community                                                  152 M

  47. Installing for dependencies:

  48. mysql-community-client                                                  x86_64                                                  5.7.21-1.el6                                                        mysql57-community                                                   23 M

  49. mysql-community-common                                                  x86_64                                                  5.7.21-1.el6                                                        mysql57-community                                                  329 k

  50. mysql-community-libs                                                    x86_64                                                  5.7.21-1.el6                                                        mysql57-community                                                  2.1 M

  51. numactl                                                                 x86_64                                                  2.0.3-9.el6                                                         test                                                                55 k

  52. perl                                                                    x86_64                                                  4:5.10.1-115.el6                                                    test                                                                10 M

  53. perl-Module-Pluggable                                                   x86_64                                                  1:3.90-115.el6                                                      test                                                                36 k

  54. perl-Pod-Escapes                                                        x86_64                                                  1:1.04-115.el6                                                      test                                                                29 k

  55. perl-Pod-Simple                                                         x86_64                                                  1:3.13-115.el6                                                      test                                                               208 k

  56. perl-libs                                                               x86_64                                                  4:5.10.1-115.el6                                                    test                                                               576 k

  57. perl-version                                                            x86_64                                                  3:0.77-115.el6                                                      test                                                                48 k


  58. Transaction Summary

  59. ==============================================================================================================================================================================================================================================================================

  60. Install      11 Package(s)

  61. Upgrade       0 Package(s)


  62. Total download size: 189 M

  63. Installed size: 919 M

  64. Is this ok [y/N]: y

  65. Downloading Packages:

  66. (1/11): mysql-community-client-5.7.21-1.el6.x86_64.rpm                                                                                                                                                                                                 |  23 MB     00:09

  67. (2/11): mysql-community-common-5.7.21-1.el6.x86_64.rpm                                                                                                                                                                                                 | 329 kB     00:00

  68. (3/11): mysql-community-libs-5.7.21-1.el6.x86_64.rpm                                                                                                                                                                                                   | 2.1 MB     00:01

  69. (4/11): mysql-community-server-5.7.21-1.el6.x86_64.rpm                                                                                                                                                                                                 | 152 MB     03:16

  70. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

  71. Total                                                                                                                                                                                                                                         925 kB/s | 189 MB     03:28

  72. warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

  73. mysql57-community/gpgkey                                                                                                                                                                                                                               |  54 kB     00:00 ...

  74. Importing GPG key 0x5072E1F5 "MySQL Release Engineering " from /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

  75. Is this ok [y/N]: y

  76. Running rpm_check_debug

  77. Running Transaction Test

  78. Transaction Test Succeeded

  79. Running Transaction

  80. Installing     : mysql-community-common-5.7.21-1.el6.x86_64                                                                                                                                                                                                            1/11

  81. Installing     : mysql-community-libs-5.7.21-1.el6.x86_64                                                                                                                                                                                                              2/11

  82. Installing     : mysql-community-client-5.7.21-1.el6.x86_64                                                                                                                                                                                                            3/11

  83. Installing     : 1:perl-Pod-Escapes-1.04-115.el6.x86_64                                                                                                                                                                                                                4/11

  84. Installing     : 3:perl-version-0.77-115.el6.x86_64                                                                                                                                                                                                                    5/11

  85. Installing     : 4:perl-libs-5.10.1-115.el6.x86_64                                                                                                                                                                                                                     6/11

  86. Installing     : 1:perl-Pod-Simple-3.13-115.el6.x86_64                                                                                                                                                                                                                 7/11

  87. Installing     : 1:perl-Module-Pluggable-3.90-115.el6.x86_64                                                                                                                                                                                                           8/11

  88. Installing     : 4:perl-5.10.1-115.el6.x86_64                                                                                                                                                                                                                          9/11

  89. Installing     : numactl-2.0.3-9.el6.x86_64                                                                                                                                                                                                                           10/11

  90. Installing     : mysql-community-server-5.7.21-1.el6.x86_64                                                                                                                                                                                                           11/11


  91. Installed:

  92. mysql-community-server.x86_64 0:5.7.21-1.el6


  93. Dependency Installed:

  94. mysql-community-client.x86_64 0:5.7.21-1.el6     mysql-community-common.x86_64 0:5.7.21-1.el6     mysql-community-libs.x86_64 0:5.7.21-1.el6     numactl.x86_64 0:2.0.3-9.el6           perl.x86_64 4:5.10.1-115.el6     perl-Module-Pluggable.x86_64 1:3.90-115.el6

  95. perl-Pod-Escapes.x86_64 1:1.04-115.el6           perl-Pod-Simple.x86_64 1:3.13-115.el6            perl-libs.x86_64 4:5.10.1-115.el6              perl-version.x86_64 3:0.77-115.el6


  96. Complete!

启动服务

点击(此处)折叠或打开

  1. [root@mysql1 yum.repos.d]# service mysqld start

  2. Initializing MySQL database:                               [  OK  ]

  3. Starting mysqld:                                           [  OK  ]

  4. [root@mysql1 yum.repos.d]# service mysqld status

  5. mysqld (pid  1628) is running..


6.修改root密码
-获得root初识密码

点击(此处)折叠或打开

  1. ]# grep 'temporary password' /var/log/mysqld.log

  2. 2018-02-25T22:53:03.372590Z 1 [Note] A temporary password is generated for root@localhost: +(LVH%nyg1vC

- 登录root
# mysql -uroot -p

-修改root密码

点击(此处)折叠或打开

  1. mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

  2. Query OK, 0 rows affected (0.01 sec)

点击(此处)折叠或打开

  1. Grant all privileges on *.* to 'root'@'%' identified by 'MyNewPass4!' with grant option;

  2. flush privileges;

感谢你能够认真阅读完这篇文章,希望小编分享的“如何使用yum方式安装mysql5.7 on linux_64”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI