当前位置:   article > 正文

centos7安装mysql_centos7下载mysql

centos7下载mysql

安装

1.下载rpm包

  1. [root@server soft]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
  2. --2024-05-26 00:47:10-- http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
  3. Resolving repo.mysql.com (repo.mysql.com)... 92.122.81.156, 2a02:26f0:61:183::1d68, 2a02:26f0:61:18d::1d68
  4. Connecting to repo.mysql.com (repo.mysql.com)|92.122.81.156|:80... connected.
  5. HTTP request sent, awaiting response... 200 OK
  6. Length: 6140 (6.0K) [application/x-redhat-package-manager]
  7. Saving to: ‘mysql-community-release-el7-5.noarch.rpm’
  8. 100%[==================>] 6,140 --.-K/s in 0s
  9. 2024-05-26 00:47:10 (662 MB/s) - ‘mysql-community-release-el7-5.noarch.rpm’ saved [6140/6140]
  10. [root@server soft]# ls
  11. mysql-community-release-el7-5.noarch.rpm

2.安装MySQL

  1. [root@server soft]# yum install -y mysql-community-release-el7-5.noarch.rpm
  2. Loaded plugins: fastestmirror, langpacks
  3. Examining mysql-community-release-el7-5.noarch.rpm: mysql-community-release-el7-5.noarch
  4. Marking mysql-community-release-el7-5.noarch.rpm to be installed
  5. Resolving Dependencies
  6. --> Running transaction check
  7. ---> Package mysql-community-release.noarch 0:el7-5 will be installed
  8. --> Finished Dependency Resolution
  9. Dependencies Resolved
  10. ============================================================
  11. Package
  12. Arch Version
  13. Repository Size
  14. ============================================================
  15. Installing:
  16. mysql-community-release
  17. noarch el7-5 /mysql-community-release-el7-5.noarch 4.3 k
  18. Transaction Summary
  19. ============================================================
  20. Install 1 Package
  21. Total size: 4.3 k
  22. Installed size: 4.3 k
  23. Downloading packages:
  24. Running transaction check
  25. Running transaction test
  26. Transaction test succeeded
  27. Running transaction
  28. Installing : mysql-community-release-el7-5.noarch 1/1
  29. Verifying : mysql-community-release-el7-5.noarch 1/1
  30. Installed:
  31. mysql-community-release.noarch 0:el7-5
  32. Complete!

3.安装MySQL服务端

  1. [root@server soft]# yum install -y mysql-community-server
  2. Loaded plugins: fastestmirror, langpacks
  3. Loading mirror speeds from cached hostfile
  4. mysql-connectors-community | 2.6 kB 00:00
  5. mysql-tools-community | 2.6 kB 00:00
  6. mysql56-community | 2.6 kB 00:00
  7. (1/3): mysql-connectors-community/x86_ | 114 kB 00:01
  8. (2/3): mysql-tools-community/x86_64/pr | 98 kB 00:01
  9. (3/3): mysql56-community/x86_64/primar | 297 kB 00:01
  10. Resolving Dependencies
  11. --> Running transaction check
  12. ---> Package mysql-community-server.x86_64 0:5.6.51-2.el7 will be installed
  13. --> Processing Dependency: mysql-community-common(x86-64) = 5.6.51-2.el7 for package: mysql-community-server-5.6.51-2.el7.x86_64
  14. --> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.51-2.el7.x86_64
  15. --> Processing Dependency: perl(DBI) for package: mysql-community-server-5.6.51-2.el7.x86_64
  16. --> Processing Dependency: perl(Data::Dumper) for package: mysql-community-server-5.6.51-2.el7.x86_64
  17. --> Running transaction check
  18. ---> Package mysql-community-client.x86_64 0:5.6.51-2.el7 will be installed
  19. --> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.51-2.el7.x86_64
  20. ---> Package mysql-community-common.x86_64 0:5.6.51-2.el7 will be installed
  21. ---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
  22. --> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
  23. --> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
  24. ---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
  25. --> Running transaction check
  26. ---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be obsoleted
  27. ---> Package mysql-community-libs.x86_64 0:5.6.51-2.el7 will be obsoleting
  28. ---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
  29. --> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
  30. --> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
  31. --> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
  32. --> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
  33. --> Running transaction check
  34. ---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
  35. --> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
  36. --> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
  37. ---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
  38. --> Running transaction check
  39. ---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
  40. ---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
  41. --> Finished Dependency Resolution
  42. Dependencies Resolved
  43. ============================================================
  44. Package Arch Version Repository
  45. Size
  46. ============================================================
  47. Installing:
  48. mysql-community-libs x86_64 5.6.51-2.el7 mysql56-community
  49. 2.2 M
  50. replacing mariadb-libs.x86_64 1:5.5.68-1.el7
  51. mysql-community-server x86_64 5.6.51-2.el7 mysql56-community
  52. 67 M
  53. Installing for dependencies:
  54. mysql-community-client x86_64 5.6.51-2.el7 mysql56-community
  55. 21 M
  56. mysql-community-common x86_64 5.6.51-2.el7 mysql56-community
  57. 287 k
  58. perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k
  59. perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k
  60. perl-DBI x86_64 1.627-4.el7 base 802 k
  61. perl-Data-Dumper x86_64 2.145-3.el7 base 47 k
  62. perl-IO-Compress noarch 2.061-2.el7 base 260 k
  63. perl-Net-Daemon noarch 0.48-5.el7 base 51 k
  64. perl-PlRPC noarch 0.2020-14.el7 base 36 k
  65. Transaction Summary
  66. ============================================================
  67. Install 2 Packages (+9 Dependent packages)
  68. Total download size: 91 M
  69. Downloading packages:
  70. warning: /var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common-5.6.51-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
  71. Public key for mysql-community-common-5.6.51-2.el7.x86_64.rpm is not installed
  72. (1/11): mysql-community-common-5.6.51- | 287 kB 00:01
  73. (2/11): mysql-community-libs-5.6.51-2. | 2.2 MB 00:01
  74. (3/11): perl-Compress-Raw-Zlib-2.061-4 | 57 kB 00:00
  75. (4/11): perl-Compress-Raw-Bzip2-2.061- | 32 kB 00:00
  76. (5/11): perl-Data-Dumper-2.145-3.el7.x | 47 kB 00:00
  77. (6/11): perl-DBI-1.627-4.el7.x86_64.rp | 802 kB 00:01
  78. (7/11): perl-Net-Daemon-0.48-5.el7.noa | 51 kB 00:00
  79. (8/11): perl-PlRPC-0.2020-14.el7.noarc | 36 kB 00:00
  80. (9/11): perl-IO-Compress-2.061-2.el7.n | 260 kB 00:01
  81. (10/11): mysql-community-server-5.6.51 | 67 MB 00:31
  82. (11/11): mysql-community-client-5.6.51 | 21 MB 00:47
  83. ------------------------------------------------------------
  84. Total 1.9 MB/s | 91 MB 00:47
  85. Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
  86. Importing GPG key 0x5072E1F5:
  87. Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
  88. Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
  89. Package : mysql-community-release-el7-5.noarch (@/mysql-community-release-el7-5.noarch)
  90. From : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
  91. Running transaction check
  92. Running transaction test
  93. Transaction test succeeded
  94. Running transaction
  95. Installing : mysql-community-common-5.6.51-2.el7. 1/12
  96. Installing : perl-Data-Dumper-2.145-3.el7.x86_64 2/12
  97. Installing : mysql-community-libs-5.6.51-2.el7.x8 3/12
  98. Installing : mysql-community-client-5.6.51-2.el7. 4/12
  99. Installing : perl-Compress-Raw-Bzip2-2.061-3.el7. 5/12
  100. Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7 6/12
  101. Installing : perl-IO-Compress-2.061-2.el7.noarch 7/12
  102. Installing : perl-Net-Daemon-0.48-5.el7.noarch 8/12
  103. Installing : perl-PlRPC-0.2020-14.el7.noarch 9/12
  104. Installing : perl-DBI-1.627-4.el7.x86_64 10/12
  105. Installing : mysql-community-server-5.6.51-2.el7. 11/12
  106. Erasing : 1:mariadb-libs-5.5.68-1.el7.x86_64 12/12
  107. Verifying : perl-Net-Daemon-0.48-5.el7.noarch 1/12
  108. Verifying : perl-Data-Dumper-2.145-3.el7.x86_64 2/12
  109. Verifying : mysql-community-libs-5.6.51-2.el7.x8 3/12
  110. Verifying : perl-IO-Compress-2.061-2.el7.noarch 4/12
  111. Verifying : mysql-community-server-5.6.51-2.el7. 5/12
  112. Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7 6/12
  113. Verifying : mysql-community-common-5.6.51-2.el7. 7/12
  114. Verifying : perl-DBI-1.627-4.el7.x86_64 8/12
  115. Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7. 9/12
  116. Verifying : perl-PlRPC-0.2020-14.el7.noarch 10/12
  117. Verifying : mysql-community-client-5.6.51-2.el7. 11/12
  118. Verifying : 1:mariadb-libs-5.5.68-1.el7.x86_64 12/12
  119. Installed:
  120. mysql-community-libs.x86_64 0:5.6.51-2.el7
  121. mysql-community-server.x86_64 0:5.6.51-2.el7
  122. Dependency Installed:
  123. mysql-community-client.x86_64 0:5.6.51-2.el7
  124. mysql-community-common.x86_64 0:5.6.51-2.el7
  125. perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7
  126. perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
  127. perl-DBI.x86_64 0:1.627-4.el7
  128. perl-Data-Dumper.x86_64 0:2.145-3.el7
  129. perl-IO-Compress.noarch 0:2.061-2.el7
  130. perl-Net-Daemon.noarch 0:0.48-5.el7
  131. perl-PlRPC.noarch 0:0.2020-14.el7
  132. Replaced:
  133. mariadb-libs.x86_64 1:5.5.68-1.el7
  134. Complete!

4.启动MySQL服务

  1. [root@server soft]# systemctl start mysqld.service
  2. [root@server soft]# systemctl status mysqld.service
  3. ● mysqld.service - MySQL Community Server
  4. Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
  5. Active: active (running) since Sun 2024-05-26 00:50:36 PDT; 36s ago
  6. Process: 7276 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
  7. Process: 7211 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
  8. Main PID: 7275 (mysqld_safe)
  9. Tasks: 23
  10. CGroup: /system.slice/mysqld.service
  11. ├─7275 /bin/sh /usr/bin/mysqld_safe --basedir=...
  12. └─7441 /usr/sbin/mysqld --basedir=/usr --datad...
  13. May 26 00:50:33 server mysql-systemd-start[7211]: 2024-05...
  14. May 26 00:50:33 server mysql-systemd-start[7211]: 2024-05...
  15. May 26 00:50:33 server mysql-systemd-start[7211]: 2024-05...
  16. May 26 00:50:35 server mysql-systemd-start[7211]: 2024-05...
  17. May 26 00:50:35 server mysql-systemd-start[7211]: PLEASE ...
  18. May 26 00:50:35 server mysql-systemd-start[7211]: To do s...
  19. May 26 00:50:35 server mysql-systemd-start[7211]: /usr/bi...
  20. May 26 00:50:35 server mysqld_safe[7275]: 240526 00:50:35...
  21. May 26 00:50:35 server mysqld_safe[7275]: 240526 00:50:35...
  22. May 26 00:50:36 server systemd[1]: Started MySQL Communit...
  23. Hint: Some lines were ellipsized, use -l to show in full.

5.查看端口

  1. [root@server soft]# netstat -na | grep 3306
  2. tcp6 0 0 :::3306 :::* LISTEN

6.查看MySQL进程

  1. [root@server soft]# ps -ef | grep mysql
  2. mysql 7275 1 0 00:50 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
  3. mysql 7441 7275 0 00:50 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
  4. root 7634 1540 0 00:59 pts/0 00:00:00 grep --color=auto mysql

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/868077
推荐阅读
相关标签
  

闽ICP备14008679号