当前位置:   article > 正文

1-linux下mysql8.0.33安装_centos linux 7.9.2009 如何安装mysql8.0.33

centos linux 7.9.2009 如何安装mysql8.0.33

在互联网企业的日常工作/运维中,我们会经常用到mysql数据库,而linux下mysql的安装方式有三种:

1.mysql rpm安装

2.mysql二进制安装

3.mysql源码安装

今天就为大家讲讲linux下mysql8.0.33版本rpm方式的安装。

1.前提

1.1.系统版本

CentOS7.9.2009

命令:

cat /etc/redhat-release

  1. [root@cent79-2 ~]# cat /etc/redhat-release
  2. CentOS Linux release 7.9.2009 (Core)
  3. [root@cent79-2 ~]#

1.2.系统基础配置

参考:

Linux常规基础配置_小黑要上天的博客-CSDN博客

1.3.预安装数据库版本

mysql8.0.33

1.4.环境初始化

  1. # 清除系统原有的MySQL环境
  2. rm -rf /var/run/yum.pid && yum remove mysql* -y && yum remove mariadb* -y
  3. find / -name mysql -exec rm -rf {} \;
  4. # 删除原有的MySQL包
  5. for i in `rpm -qa |grep mysql`
  6. do
  7. rpm -e --nodeps $i
  8. done

2.mysql8.0.33介质下载

2.1.官网地址

官网地址:

https://dev.mysql.com/downloads/mysql/

2.2.安装软件包

命令:

yum install wget tar lrzsz

  1. [root@cent79-2 ~]# yum install wget tar lrzsz
  2. Loaded plugins: fastestmirror
  3. Loading mirror speeds from cached hostfile
  4. CentOS7 | 3.6 kB 00:00:00
  5. Package 2:tar-1.26-35.el7.x86_64 already installed and latest version
  6. Resolving Dependencies
  7. --> Running transaction check
  8. ---> Package lrzsz.x86_64 0:0.12.20-36.el7 will be installed
  9. ---> Package wget.x86_64 0:1.14-18.el7_6.1 will be installed
  10. --> Finished Dependency Resolution
  11. Dependencies Resolved
  12. ==============================================================================================
  13. Package Arch Version Repository Size
  14. ==============================================================================================
  15. Installing:
  16. lrzsz x86_64 0.12.20-36.el7 CentOS7 78 k
  17. wget x86_64 1.14-18.el7_6.1 CentOS7 547 k
  18. Transaction Summary
  19. ==============================================================================================
  20. Install 2 Packages
  21. Total download size: 625 k
  22. Installed size: 2.1 M
  23. Is this ok [y/d/N]: y
  24. Downloading packages:
  25. ----------------------------------------------------------------------------------------------
  26. Total 380 kB/s | 625 kB 00:00:01
  27. Running transaction check
  28. Running transaction test
  29. Transaction test succeeded
  30. Running transaction
  31. Installing : wget-1.14-18.el7_6.1.x86_64 1/2
  32. Installing : lrzsz-0.12.20-36.el7.x86_64 2/2
  33. Verifying : lrzsz-0.12.20-36.el7.x86_64 1/2
  34. Verifying : wget-1.14-18.el7_6.1.x86_64 2/2
  35. Installed:
  36. lrzsz.x86_64 0:0.12.20-36.el7 wget.x86_64 0:1.14-18.el7_6.1
  37. Complete!
  38. [root@cent79-2 ~]#

命令:

yum install ncurses-devel libaio-devel gcc gcc-c++ numactl libaio glibc cmake autoconf libstdc++.x86_64 libstdc++.i686 bzip2 bison net-tools -y

  1. [root@cent79-2 ~]# yum install ncurses-devel libaio-devel gcc gcc-c++ numactl libaio glibc cmake autoconf libstdc++.x86_64 libstdc++.i686 bzip2 bison net-tools -y
  2. Loaded plugins: fastestmirror
  3. Loading mirror speeds from cached hostfile
  4. Package libaio-0.3.109-13.el7.x86_64 already installed and latest version
  5. Package glibc-2.17-317.el7.x86_64 already installed and latest version
  6. Package libstdc++-4.8.5-44.el7.x86_64 already installed and latest version
  7. No package libstdc++.i686 available.
  8. Resolving Dependencies
  9. --> Running transaction check
  10. ---> Package autoconf.noarch 0:2.69-11.el7 will be installed
  11. --> Processing Dependency: perl >= 5.006 for package: autoconf-2.69-11.el7.noarch
  12. --> Processing Dependency: m4 >= 1.4.14 for package: autoconf-2.69-11.el7.noarch
  13. --> Processing Dependency: perl(warnings) for package: autoconf-2.69-11.el7.noarch
  14. --> Processing Dependency: perl(vars) for package: autoconf-2.69-11.el7.noarch
  15. --> Processing Dependency: perl(strict) for package: autoconf-2.69-11.el7.noarch
  16. --> Processing Dependency: perl(constant) for package: autoconf-2.69-11.el7.noarch
  17. --> Processing Dependency: perl(Text::ParseWords) for package: autoconf-2.69-11.el7.noarch
  18. --> Processing Dependency: perl(POSIX) for package: autoconf-2.69-11.el7.noarch
  19. --> Processing Dependency: perl(IO::File) for package: autoconf-2.69-11.el7.noarch
  20. --> Processing Dependency: perl(Getopt::Long) for package: autoconf-2.69-11.el7.noarch
  21. --> Processing Dependency: perl(File::stat) for package: autoconf-2.69-11.el7.noarch
  22. --> Processing Dependency: perl(File::Spec) for package: autoconf-2.69-11.el7.noarch
  23. --> Processing Dependency: perl(File::Path) for package: autoconf-2.69-11.el7.noarch
  24. --> Processing Dependency: perl(File::Find) for package: autoconf-2.69-11.el7.noarch
  25. --> Processing Dependency: perl(File::Copy) for package: autoconf-2.69-11.el7.noarch
  26. --> Processing Dependency: perl(File::Compare) for package: autoconf-2.69-11.el7.noarch
  27. --> Processing Dependency: perl(File::Basename) for package: autoconf-2.69-11.el7.noarch
  28. --> Processing Dependency: perl(Exporter) for package: autoconf-2.69-11.el7.noarch
  29. --> Processing Dependency: perl(Errno) for package: autoconf-2.69-11.el7.noarch
  30. --> Processing Dependency: perl(DynaLoader) for package: autoconf-2.69-11.el7.noarch
  31. --> Processing Dependency: perl(Data::Dumper) for package: autoconf-2.69-11.el7.noarch
  32. --> Processing Dependency: perl(Cwd) for package: autoconf-2.69-11.el7.noarch
  33. --> Processing Dependency: perl(Class::Struct) for package: autoconf-2.69-11.el7.noarch
  34. --> Processing Dependency: perl(Carp) for package: autoconf-2.69-11.el7.noarch
  35. --> Processing Dependency: /usr/bin/perl for package: autoconf-2.69-11.el7.noarch
  36. ---> Package bison.x86_64 0:3.0.4-2.el7 will be installed
  37. ---> Package bzip2.x86_64 0:1.0.6-13.el7 will be installed
  38. ---> Package cmake.x86_64 0:2.8.12.2-2.el7 will be installed
  39. --> Processing Dependency: libarchive.so.13()(64bit) for package: cmake-2.8.12.2-2.el7.x86_64
  40. ---> Package gcc.x86_64 0:4.8.5-44.el7 will be installed
  41. --> Processing Dependency: cpp = 4.8.5-44.el7 for package: gcc-4.8.5-44.el7.x86_64
  42. --> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-44.el7.x86_64
  43. --> Processing Dependency: libmpfr.so.4()(64bit) for package: gcc-4.8.5-44.el7.x86_64
  44. --> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.5-44.el7.x86_64
  45. ---> Package gcc-c++.x86_64 0:4.8.5-44.el7 will be installed
  46. --> Processing Dependency: libstdc++-devel = 4.8.5-44.el7 for package: gcc-c++-4.8.5-44.el7.x86_64
  47. ---> Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed
  48. ---> Package ncurses-devel.x86_64 0:5.9-14.20130511.el7_4 will be installed
  49. ---> Package numactl.x86_64 0:2.0.12-5.el7 will be installed
  50. --> Running transaction check
  51. ---> Package cpp.x86_64 0:4.8.5-44.el7 will be installed
  52. ---> Package glibc-devel.x86_64 0:2.17-317.el7 will be installed
  53. --> Processing Dependency: glibc-headers = 2.17-317.el7 for package: glibc-devel-2.17-317.el7.x86_64
  54. --> Processing Dependency: glibc-headers for package: glibc-devel-2.17-317.el7.x86_64
  55. ---> Package libarchive.x86_64 0:3.1.2-14.el7_7 will be installed
  56. ---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed
  57. ---> Package libstdc++-devel.x86_64 0:4.8.5-44.el7 will be installed
  58. ---> Package m4.x86_64 0:1.4.16-10.el7 will be installed
  59. ---> Package mpfr.x86_64 0:3.1.1-4.el7 will be installed
  60. ---> Package perl.x86_64 4:5.16.3-297.el7 will be installed
  61. --> Processing Dependency: perl-libs = 4:5.16.3-297.el7 for package: 4:perl-5.16.3-297.el7.x86_64
  62. --> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-297.el7.x86_64
  63. --> Processing Dependency: perl(Scalar::Util) >= 1.10 for package: 4:perl-5.16.3-297.el7.x86_64
  64. --> Processing Dependency: perl-macros for package: 4:perl-5.16.3-297.el7.x86_64
  65. --> Processing Dependency: perl-libs for package: 4:perl-5.16.3-297.el7.x86_64
  66. --> Processing Dependency: perl(threads::shared) for package: 4:perl-5.16.3-297.el7.x86_64
  67. --> Processing Dependency: perl(threads) for package: 4:perl-5.16.3-297.el7.x86_64
  68. --> Processing Dependency: perl(Time::Local) for package: 4:perl-5.16.3-297.el7.x86_64
  69. --> Processing Dependency: perl(Time::HiRes) for package: 4:perl-5.16.3-297.el7.x86_64
  70. --> Processing Dependency: perl(Storable) for package: 4:perl-5.16.3-297.el7.x86_64
  71. --> Processing Dependency: perl(Socket) for package: 4:perl-5.16.3-297.el7.x86_64
  72. --> Processing Dependency: perl(Scalar::Util) for package: 4:perl-5.16.3-297.el7.x86_64
  73. --> Processing Dependency: perl(Pod::Simple::XHTML) for package: 4:perl-5.16.3-297.el7.x86_64
  74. --> Processing Dependency: perl(Pod::Simple::Search) for package: 4:perl-5.16.3-297.el7.x86_64
  75. --> Processing Dependency: perl(Filter::Util::Call) for package: 4:perl-5.16.3-297.el7.x86_64
  76. --> Processing Dependency: perl(File::Temp) for package: 4:perl-5.16.3-297.el7.x86_64
  77. --> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.16.3-297.el7.x86_64
  78. ---> Package perl-Carp.noarch 0:1.26-244.el7 will be installed
  79. ---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
  80. ---> Package perl-Exporter.noarch 0:5.68-3.el7 will be installed
  81. ---> Package perl-File-Path.noarch 0:2.09-2.el7 will be installed
  82. ---> Package perl-Getopt-Long.noarch 0:2.40-3.el7 will be installed
  83. --> Processing Dependency: perl(Pod::Usage) >= 1.14 for package: perl-Getopt-Long-2.40-3.el7.noarch
  84. ---> Package perl-PathTools.x86_64 0:3.40-5.el7 will be installed
  85. ---> Package perl-Text-ParseWords.noarch 0:3.29-4.el7 will be installed
  86. ---> Package perl-constant.noarch 0:1.27-2.el7 will be installed
  87. --> Running transaction check
  88. ---> Package glibc-headers.x86_64 0:2.17-317.el7 will be installed
  89. --> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-317.el7.x86_64
  90. --> Processing Dependency: kernel-headers for package: glibc-headers-2.17-317.el7.x86_64
  91. ---> Package perl-File-Temp.noarch 0:0.23.01-3.el7 will be installed
  92. ---> Package perl-Filter.x86_64 0:1.49-3.el7 will be installed
  93. ---> Package perl-Pod-Simple.noarch 1:3.28-4.el7 will be installed
  94. --> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
  95. --> Processing Dependency: perl(Encode) for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
  96. ---> Package perl-Pod-Usage.noarch 0:1.63-3.el7 will be installed
  97. --> Processing Dependency: perl(Pod::Text) >= 3.15 for package: perl-Pod-Usage-1.63-3.el7.noarch
  98. --> Processing Dependency: perl-Pod-Perldoc for package: perl-Pod-Usage-1.63-3.el7.noarch
  99. ---> Package perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 will be installed
  100. ---> Package perl-Socket.x86_64 0:2.010-5.el7 will be installed
  101. ---> Package perl-Storable.x86_64 0:2.45-3.el7 will be installed
  102. ---> Package perl-Time-HiRes.x86_64 4:1.9725-3.el7 will be installed
  103. ---> Package perl-Time-Local.noarch 0:1.2300-2.el7 will be installed
  104. ---> Package perl-libs.x86_64 4:5.16.3-297.el7 will be installed
  105. ---> Package perl-macros.x86_64 4:5.16.3-297.el7 will be installed
  106. ---> Package perl-threads.x86_64 0:1.87-4.el7 will be installed
  107. ---> Package perl-threads-shared.x86_64 0:1.43-6.el7 will be installed
  108. --> Running transaction check
  109. ---> Package kernel-headers.x86_64 0:3.10.0-1160.el7 will be installed
  110. ---> Package perl-Encode.x86_64 0:2.51-7.el7 will be installed
  111. ---> Package perl-Pod-Escapes.noarch 1:1.04-297.el7 will be installed
  112. ---> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed
  113. --> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
  114. --> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
  115. ---> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed
  116. --> Running transaction check
  117. ---> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed
  118. ---> Package perl-parent.noarch 1:0.225-244.el7 will be installed
  119. --> Finished Dependency Resolution
  120. Dependencies Resolved
  121. ==============================================================================================
  122. Package Arch Version Repository Size
  123. ==============================================================================================
  124. Installing:
  125. autoconf noarch 2.69-11.el7 CentOS7 701 k
  126. bison x86_64 3.0.4-2.el7 CentOS7 674 k
  127. bzip2 x86_64 1.0.6-13.el7 CentOS7 52 k
  128. cmake x86_64 2.8.12.2-2.el7 CentOS7 7.1 M
  129. gcc x86_64 4.8.5-44.el7 CentOS7 16 M
  130. gcc-c++ x86_64 4.8.5-44.el7 CentOS7 7.2 M
  131. libaio-devel x86_64 0.3.109-13.el7 CentOS7 13 k
  132. ncurses-devel x86_64 5.9-14.20130511.el7_4 CentOS7 712 k
  133. numactl x86_64 2.0.12-5.el7 CentOS7 66 k
  134. Installing for dependencies:
  135. cpp x86_64 4.8.5-44.el7 CentOS7 5.9 M
  136. glibc-devel x86_64 2.17-317.el7 CentOS7 1.1 M
  137. glibc-headers x86_64 2.17-317.el7 CentOS7 690 k
  138. kernel-headers x86_64 3.10.0-1160.el7 CentOS7 9.0 M
  139. libarchive x86_64 3.1.2-14.el7_7 CentOS7 319 k
  140. libmpc x86_64 1.0.1-3.el7 CentOS7 51 k
  141. libstdc++-devel x86_64 4.8.5-44.el7 CentOS7 1.5 M
  142. m4 x86_64 1.4.16-10.el7 CentOS7 256 k
  143. mpfr x86_64 3.1.1-4.el7 CentOS7 203 k
  144. perl x86_64 4:5.16.3-297.el7 CentOS7 8.0 M
  145. perl-Carp noarch 1.26-244.el7 CentOS7 19 k
  146. perl-Data-Dumper x86_64 2.145-3.el7 CentOS7 47 k
  147. perl-Encode x86_64 2.51-7.el7 CentOS7 1.5 M
  148. perl-Exporter noarch 5.68-3.el7 CentOS7 28 k
  149. perl-File-Path noarch 2.09-2.el7 CentOS7 26 k
  150. perl-File-Temp noarch 0.23.01-3.el7 CentOS7 56 k
  151. perl-Filter x86_64 1.49-3.el7 CentOS7 76 k
  152. perl-Getopt-Long noarch 2.40-3.el7 CentOS7 56 k
  153. perl-HTTP-Tiny noarch 0.033-3.el7 CentOS7 38 k
  154. perl-PathTools x86_64 3.40-5.el7 CentOS7 82 k
  155. perl-Pod-Escapes noarch 1:1.04-297.el7 CentOS7 52 k
  156. perl-Pod-Perldoc noarch 3.20-4.el7 CentOS7 87 k
  157. perl-Pod-Simple noarch 1:3.28-4.el7 CentOS7 216 k
  158. perl-Pod-Usage noarch 1.63-3.el7 CentOS7 27 k
  159. perl-Scalar-List-Utils x86_64 1.27-248.el7 CentOS7 36 k
  160. perl-Socket x86_64 2.010-5.el7 CentOS7 49 k
  161. perl-Storable x86_64 2.45-3.el7 CentOS7 77 k
  162. perl-Text-ParseWords noarch 3.29-4.el7 CentOS7 14 k
  163. perl-Time-HiRes x86_64 4:1.9725-3.el7 CentOS7 45 k
  164. perl-Time-Local noarch 1.2300-2.el7 CentOS7 24 k
  165. perl-constant noarch 1.27-2.el7 CentOS7 19 k
  166. perl-libs x86_64 4:5.16.3-297.el7 CentOS7 689 k
  167. perl-macros x86_64 4:5.16.3-297.el7 CentOS7 44 k
  168. perl-parent noarch 1:0.225-244.el7 CentOS7 12 k
  169. perl-podlators noarch 2.5.1-3.el7 CentOS7 112 k
  170. perl-threads x86_64 1.87-4.el7 CentOS7 49 k
  171. perl-threads-shared x86_64 1.43-6.el7 CentOS7 39 k
  172. Transaction Summary
  173. ==============================================================================================
  174. Install 9 Packages (+37 Dependent packages)
  175. Total download size: 63 M
  176. Installed size: 155 M
  177. Downloading packages:
  178. ----------------------------------------------------------------------------------------------
  179. Total 21 MB/s | 63 MB 00:00:03
  180. Running transaction check
  181. Running transaction test
  182. Transaction test succeeded
  183. Running transaction
  184. Installing : mpfr-3.1.1-4.el7.x86_64 1/46
  185. Installing : libmpc-1.0.1-3.el7.x86_64 2/46
  186. Installing : m4-1.4.16-10.el7.x86_64 3/46
  187. Installing : cpp-4.8.5-44.el7.x86_64 4/46
  188. Installing : 1:perl-parent-0.225-244.el7.noarch 5/46
  189. Installing : perl-HTTP-Tiny-0.033-3.el7.noarch 6/46
  190. Installing : perl-podlators-2.5.1-3.el7.noarch 7/46
  191. Installing : perl-Pod-Perldoc-3.20-4.el7.noarch 8/46
  192. Installing : 1:perl-Pod-Escapes-1.04-297.el7.noarch 9/46
  193. Installing : perl-Encode-2.51-7.el7.x86_64 10/46
  194. Installing : perl-Text-ParseWords-3.29-4.el7.noarch 11/46
  195. Installing : perl-Pod-Usage-1.63-3.el7.noarch 12/46
  196. Installing : 4:perl-libs-5.16.3-297.el7.x86_64 13/46
  197. Installing : 4:perl-Time-HiRes-1.9725-3.el7.x86_64 14/46
  198. Installing : perl-Exporter-5.68-3.el7.noarch 15/46
  199. Installing : perl-constant-1.27-2.el7.noarch 16/46
  200. Installing : perl-threads-1.87-4.el7.x86_64 17/46
  201. Installing : perl-Socket-2.010-5.el7.x86_64 18/46
  202. Installing : perl-Time-Local-1.2300-2.el7.noarch 19/46
  203. Installing : perl-Carp-1.26-244.el7.noarch 20/46
  204. Installing : perl-Storable-2.45-3.el7.x86_64 21/46
  205. Installing : perl-threads-shared-1.43-6.el7.x86_64 22/46
  206. Installing : perl-PathTools-3.40-5.el7.x86_64 23/46
  207. Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64 24/46
  208. Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch 25/46
  209. Installing : perl-File-Temp-0.23.01-3.el7.noarch 26/46
  210. Installing : perl-File-Path-2.09-2.el7.noarch 27/46
  211. Installing : perl-Filter-1.49-3.el7.x86_64 28/46
  212. Installing : 4:perl-macros-5.16.3-297.el7.x86_64 29/46
  213. Installing : perl-Getopt-Long-2.40-3.el7.noarch 30/46
  214. Installing : 4:perl-5.16.3-297.el7.x86_64 31/46
  215. Installing : perl-Data-Dumper-2.145-3.el7.x86_64 32/46
  216. Installing : libarchive-3.1.2-14.el7_7.x86_64 33/46
  217. Installing : libstdc++-devel-4.8.5-44.el7.x86_64 34/46
  218. Installing : kernel-headers-3.10.0-1160.el7.x86_64 35/46
  219. Installing : glibc-headers-2.17-317.el7.x86_64 36/46
  220. Installing : glibc-devel-2.17-317.el7.x86_64 37/46
  221. Installing : gcc-4.8.5-44.el7.x86_64 38/46
  222. Installing : gcc-c++-4.8.5-44.el7.x86_64 39/46
  223. Installing : cmake-2.8.12.2-2.el7.x86_64 40/46
  224. Installing : autoconf-2.69-11.el7.noarch 41/46
  225. Installing : bison-3.0.4-2.el7.x86_64 42/46
  226. Installing : numactl-2.0.12-5.el7.x86_64 43/46
  227. Installing : libaio-devel-0.3.109-13.el7.x86_64 44/46
  228. Installing : ncurses-devel-5.9-14.20130511.el7_4.x86_64 45/46
  229. Installing : bzip2-1.0.6-13.el7.x86_64 46/46
  230. Verifying : perl-HTTP-Tiny-0.033-3.el7.noarch 1/46
  231. Verifying : gcc-c++-4.8.5-44.el7.x86_64 2/46
  232. Verifying : kernel-headers-3.10.0-1160.el7.x86_64 3/46
  233. Verifying : perl-threads-shared-1.43-6.el7.x86_64 4/46
  234. Verifying : 4:perl-Time-HiRes-1.9725-3.el7.x86_64 5/46
  235. Verifying : 4:perl-libs-5.16.3-297.el7.x86_64 6/46
  236. Verifying : mpfr-3.1.1-4.el7.x86_64 7/46
  237. Verifying : perl-Exporter-5.68-3.el7.noarch 8/46
  238. Verifying : perl-constant-1.27-2.el7.noarch 9/46
  239. Verifying : perl-PathTools-3.40-5.el7.x86_64 10/46
  240. Verifying : perl-threads-1.87-4.el7.x86_64 11/46
  241. Verifying : m4-1.4.16-10.el7.x86_64 12/46
  242. Verifying : perl-Socket-2.010-5.el7.x86_64 13/46
  243. Verifying : 1:perl-parent-0.225-244.el7.noarch 14/46
  244. Verifying : bzip2-1.0.6-13.el7.x86_64 15/46
  245. Verifying : 1:perl-Pod-Escapes-1.04-297.el7.noarch 16/46
  246. Verifying : ncurses-devel-5.9-14.20130511.el7_4.x86_64 17/46
  247. Verifying : cpp-4.8.5-44.el7.x86_64 18/46
  248. Verifying : 1:perl-Pod-Simple-3.28-4.el7.noarch 19/46
  249. Verifying : perl-Time-Local-1.2300-2.el7.noarch 20/46
  250. Verifying : libstdc++-devel-4.8.5-44.el7.x86_64 21/46
  251. Verifying : perl-Carp-1.26-244.el7.noarch 22/46
  252. Verifying : libarchive-3.1.2-14.el7_7.x86_64 23/46
  253. Verifying : perl-Data-Dumper-2.145-3.el7.x86_64 24/46
  254. Verifying : glibc-headers-2.17-317.el7.x86_64 25/46
  255. Verifying : perl-Storable-2.45-3.el7.x86_64 26/46
  256. Verifying : gcc-4.8.5-44.el7.x86_64 27/46
  257. Verifying : perl-Scalar-List-Utils-1.27-248.el7.x86_64 28/46
  258. Verifying : libaio-devel-0.3.109-13.el7.x86_64 29/46
  259. Verifying : libmpc-1.0.1-3.el7.x86_64 30/46
  260. Verifying : perl-File-Temp-0.23.01-3.el7.noarch 31/46
  261. Verifying : numactl-2.0.12-5.el7.x86_64 32/46
  262. Verifying : perl-Pod-Usage-1.63-3.el7.noarch 33/46
  263. Verifying : perl-Encode-2.51-7.el7.x86_64 34/46
  264. Verifying : glibc-devel-2.17-317.el7.x86_64 35/46
  265. Verifying : bison-3.0.4-2.el7.x86_64 36/46
  266. Verifying : perl-Pod-Perldoc-3.20-4.el7.noarch 37/46
  267. Verifying : perl-podlators-2.5.1-3.el7.noarch 38/46
  268. Verifying : autoconf-2.69-11.el7.noarch 39/46
  269. Verifying : perl-File-Path-2.09-2.el7.noarch 40/46
  270. Verifying : cmake-2.8.12.2-2.el7.x86_64 41/46
  271. Verifying : perl-Filter-1.49-3.el7.x86_64 42/46
  272. Verifying : perl-Getopt-Long-2.40-3.el7.noarch 43/46
  273. Verifying : perl-Text-ParseWords-3.29-4.el7.noarch 44/46
  274. Verifying : 4:perl-5.16.3-297.el7.x86_64 45/46
  275. Verifying : 4:perl-macros-5.16.3-297.el7.x86_64 46/46
  276. Installed:
  277. autoconf.noarch 0:2.69-11.el7 bison.x86_64 0:3.0.4-2.el7
  278. bzip2.x86_64 0:1.0.6-13.el7 cmake.x86_64 0:2.8.12.2-2.el7
  279. gcc.x86_64 0:4.8.5-44.el7 gcc-c++.x86_64 0:4.8.5-44.el7
  280. libaio-devel.x86_64 0:0.3.109-13.el7 ncurses-devel.x86_64 0:5.9-14.20130511.el7_4
  281. numactl.x86_64 0:2.0.12-5.el7
  282. Dependency Installed:
  283. cpp.x86_64 0:4.8.5-44.el7 glibc-devel.x86_64 0:2.17-317.el7
  284. glibc-headers.x86_64 0:2.17-317.el7 kernel-headers.x86_64 0:3.10.0-1160.el7
  285. libarchive.x86_64 0:3.1.2-14.el7_7 libmpc.x86_64 0:1.0.1-3.el7
  286. libstdc++-devel.x86_64 0:4.8.5-44.el7 m4.x86_64 0:1.4.16-10.el7
  287. mpfr.x86_64 0:3.1.1-4.el7 perl.x86_64 4:5.16.3-297.el7
  288. perl-Carp.noarch 0:1.26-244.el7 perl-Data-Dumper.x86_64 0:2.145-3.el7
  289. perl-Encode.x86_64 0:2.51-7.el7 perl-Exporter.noarch 0:5.68-3.el7
  290. perl-File-Path.noarch 0:2.09-2.el7 perl-File-Temp.noarch 0:0.23.01-3.el7
  291. perl-Filter.x86_64 0:1.49-3.el7 perl-Getopt-Long.noarch 0:2.40-3.el7
  292. perl-HTTP-Tiny.noarch 0:0.033-3.el7 perl-PathTools.x86_64 0:3.40-5.el7
  293. perl-Pod-Escapes.noarch 1:1.04-297.el7 perl-Pod-Perldoc.noarch 0:3.20-4.el7
  294. perl-Pod-Simple.noarch 1:3.28-4.el7 perl-Pod-Usage.noarch 0:1.63-3.el7
  295. perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 perl-Socket.x86_64 0:2.010-5.el7
  296. perl-Storable.x86_64 0:2.45-3.el7 perl-Text-ParseWords.noarch 0:3.29-4.el7
  297. perl-Time-HiRes.x86_64 4:1.9725-3.el7 perl-Time-Local.noarch 0:1.2300-2.el7
  298. perl-constant.noarch 0:1.27-2.el7 perl-libs.x86_64 4:5.16.3-297.el7
  299. perl-macros.x86_64 4:5.16.3-297.el7 perl-parent.noarch 1:0.225-244.el7
  300. perl-podlators.noarch 0:2.5.1-3.el7 perl-threads.x86_64 0:1.87-4.el7
  301. perl-threads-shared.x86_64 0:1.43-6.el7
  302. Complete!
  303. [root@cent79-2 ~]#

2.3.mysql8.0.33介质下载

命令:

cd /root
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar

  1. [root@cent79-2 ~]# cd /root
  2. [root@cent79-2 ~]# wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
  3. --2023-07-11 15:12:14-- https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
  4. Resolving cdn.mysql.com (cdn.mysql.com)... 23.41.161.20
  5. Connecting to cdn.mysql.com (cdn.mysql.com)|23.41.161.20|:443... connected.
  6. HTTP request sent, awaiting response... 200 OK
  7. Length: 1027983360 (980M) [application/x-tar]
  8. Saving to: ‘mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar’
  9. 0% [ ] 7,162,447 2.61MB/s
  10. [root@cent79-2 ~]#
  11. [root@cent79-2 ~]# ls
  12. anaconda-ks.cfg mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
  13. [root@cent79-2 ~]#

2.4.mysql8.0.33安装

2.4.1.解压mysql8.0.33介质

命令:

tar -xvf mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar

  1. [root@cent79-2 ~]# tar -xvf mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
  2. mysql-community-client-8.0.33-1.el7.x86_64.rpm
  3. mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm
  4. mysql-community-common-8.0.33-1.el7.x86_64.rpm
  5. mysql-community-debuginfo-8.0.33-1.el7.x86_64.rpm
  6. mysql-community-devel-8.0.33-1.el7.x86_64.rpm
  7. mysql-community-embedded-compat-8.0.33-1.el7.x86_64.rpm
  8. mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm
  9. mysql-community-libs-8.0.33-1.el7.x86_64.rpm
  10. mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm
  11. mysql-community-server-8.0.33-1.el7.x86_64.rpm
  12. mysql-community-server-debug-8.0.33-1.el7.x86_64.rpm
  13. mysql-community-test-8.0.33-1.el7.x86_64.rpm
  14. [root@cent79-2 ~]# ls
  15. anaconda-ks.cfg
  16. mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
  17. mysql-community-client-8.0.33-1.el7.x86_64.rpm
  18. mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm
  19. mysql-community-common-8.0.33-1.el7.x86_64.rpm
  20. mysql-community-debuginfo-8.0.33-1.el7.x86_64.rpm
  21. mysql-community-devel-8.0.33-1.el7.x86_64.rpm
  22. mysql-community-embedded-compat-8.0.33-1.el7.x86_64.rpm
  23. mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm
  24. mysql-community-libs-8.0.33-1.el7.x86_64.rpm
  25. mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm
  26. mysql-community-server-8.0.33-1.el7.x86_64.rpm
  27. mysql-community-server-debug-8.0.33-1.el7.x86_64.rpm
  28. mysql-community-test-8.0.33-1.el7.x86_64.rpm
  29. [root@cent79-2 ~]#

2.4.2.mysql8.0.33安装

命令(安装顺序一定不能变):

rpm -ivh --nodeps --force mysql-community-common-8.0.33-1.el7.x86_64.rpm
rpm -ivh --nodeps --force mysql-community-libs-8.0.33-1.el7.x86_64.rpm      
rpm -ivh --nodeps --force mysql-community-client-8.0.33-1.el7.x86_64.rpm 
rpm -ivh --nodeps --force mysql-community-server-8.0.33-1.el7.x86_64.rpm

  1. [root@cent79-2 ~]# rpm -ivh --nodeps --force mysql-community-common-8.0.33-1.el7.x86_64.rpm
  2. warning: mysql-community-common-8.0.33-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
  3. Preparing... ################################# [100%]
  4. Updating / installing...
  5. 1:mysql-community-common-8.0.33-1.e################################# [100%]
  6. [root@cent79-2 ~]# rpm -ivh --nodeps --force mysql-community-libs-8.0.33-1.el7.x86_64.rpm
  7. warning: mysql-community-libs-8.0.33-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
  8. Preparing... ################################# [100%]
  9. Updating / installing...
  10. 1:mysql-community-libs-8.0.33-1.el7################################# [100%]
  11. [root@cent79-2 ~]# rpm -ivh --nodeps --force mysql-community-client-8.0.33-1.el7.x86_64.rpm
  12. warning: mysql-community-client-8.0.33-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
  13. Preparing... ################################# [100%]
  14. Updating / installing...
  15. 1:mysql-community-client-8.0.33-1.e################################# [100%]
  16. [root@cent79-2 ~]# rpm -ivh --nodeps --force mysql-community-server-8.0.33-1.el7.x86_64.rpm
  17. warning: mysql-community-server-8.0.33-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
  18. Preparing... ################################# [100%]
  19. Updating / installing...
  20. 1:mysql-community-server-8.0.33-1.e################################# [100%]
  21. [root@cent79-2 ~]#
  22. [root@cent79-2 ~]#

2.4.3.mysql安装后确认

mysql8.0.33默认安装在/var/lib/mysql目录,且会默认创建mysql用户

rpm -qa |grep mysql

cd /var/lib

ls -ld mysql*

cat /etc/passwd |grep mysql

  1. [root@cent79-2 mysql]# rpm -qa |grep mysql
  2. mysql-community-libs-8.0.33-1.el7.x86_64
  3. mysql-community-server-8.0.33-1.el7.x86_64
  4. mysql-community-common-8.0.33-1.el7.x86_64
  5. mysql-community-client-8.0.33-1.el7.x86_64
  6. [root@cent79-2 mysql]#
  7. [root@cent79-2 lib]# cd /var/lib/
  8. [root@cent79-2 lib]# ls -ld mysql*
  9. drwxr-x--x 2 mysql mysql 6 Mar 17 02:51 mysql
  10. drwxr-x--- 2 mysql mysql 6 Mar 17 02:51 mysql-files
  11. drwxr-x--- 2 mysql mysql 6 Mar 17 02:51 mysql-keyring
  12. [root@cent79-2 lib]# cat /etc/passwd |grep mysql
  13. mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/false
  14. [root@cent79-2 lib]#

2.4.4.启动mysql

命令:

systemctl start mysqld
systemctl enable mysqld
systemctl status mysqld

cd /var/lib/mysql

ls -l

  1. [root@cent79-2 lib]# systemctl start mysqld
  2. [root@cent79-2 lib]# systemctl enable mysqld
  3. [root@cent79-2 lib]# systemctl status mysqld
  4. ● mysqld.service - MySQL Server
  5. Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
  6. Active: active (running) since Tue 2023-07-11 15:29:51 CST; 10s ago
  7. Docs: man:mysqld(8)
  8. http://dev.mysql.com/doc/refman/en/using-systemd.html
  9. Main PID: 1966 (mysqld)
  10. Status: "Server is operational"
  11. CGroup: /system.slice/mysqld.service
  12. └─1966 /usr/sbin/mysqld
  13. Jul 11 15:29:39 cent79-2 systemd[1]: Starting MySQL Server...
  14. Jul 11 15:29:51 cent79-2 systemd[1]: Started MySQL Server.
  15. [root@cent79-2 lib]# cd mysql
  16. [root@cent79-2 mysql]# ls
  17. auto.cnf client-cert.pem ibdata1 mysql.ibd public_key.pem undo_002
  18. binlog.000001 client-key.pem ibtmp1 mysql.sock server-cert.pem
  19. binlog.index #ib_16384_0.dblwr #innodb_redo mysql.sock.lock server-key.pem
  20. ca-key.pem #ib_16384_1.dblwr #innodb_temp performance_schema sys
  21. ca.pem ib_buffer_pool mysql private_key.pem undo_001
  22. [root@cent79-2 mysql]# ls -l
  23. total 90568
  24. -rw-r----- 1 mysql mysql 56 Jul 11 15:29 auto.cnf
  25. -rw-r----- 1 mysql mysql 157 Jul 11 15:29 binlog.000001
  26. -rw-r----- 1 mysql mysql 16 Jul 11 15:29 binlog.index
  27. -rw------- 1 mysql mysql 1676 Jul 11 15:29 ca-key.pem
  28. -rw-r--r-- 1 mysql mysql 1112 Jul 11 15:29 ca.pem
  29. -rw-r--r-- 1 mysql mysql 1112 Jul 11 15:29 client-cert.pem
  30. -rw------- 1 mysql mysql 1676 Jul 11 15:29 client-key.pem
  31. -rw-r----- 1 mysql mysql 196608 Jul 11 15:29 #ib_16384_0.dblwr
  32. -rw-r----- 1 mysql mysql 8585216 Jul 11 15:29 #ib_16384_1.dblwr
  33. -rw-r----- 1 mysql mysql 5985 Jul 11 15:29 ib_buffer_pool
  34. -rw-r----- 1 mysql mysql 12582912 Jul 11 15:29 ibdata1
  35. -rw-r----- 1 mysql mysql 12582912 Jul 11 15:29 ibtmp1
  36. drwxr-x--- 2 mysql mysql 4096 Jul 11 15:29 #innodb_redo
  37. drwxr-x--- 2 mysql mysql 187 Jul 11 15:29 #innodb_temp
  38. drwxr-x--- 2 mysql mysql 143 Jul 11 15:29 mysql
  39. -rw-r----- 1 mysql mysql 25165824 Jul 11 15:29 mysql.ibd
  40. srwxrwxrwx 1 mysql mysql 0 Jul 11 15:29 mysql.sock
  41. -rw------- 1 mysql mysql 5 Jul 11 15:29 mysql.sock.lock
  42. drwxr-x--- 2 mysql mysql 8192 Jul 11 15:29 performance_schema
  43. -rw------- 1 mysql mysql 1676 Jul 11 15:29 private_key.pem
  44. -rw-r--r-- 1 mysql mysql 452 Jul 11 15:29 public_key.pem
  45. -rw-r--r-- 1 mysql mysql 1112 Jul 11 15:29 server-cert.pem
  46. -rw------- 1 mysql mysql 1676 Jul 11 15:29 server-key.pem
  47. drwxr-x--- 2 mysql mysql 28 Jul 11 15:29 sys
  48. -rw-r----- 1 mysql mysql 16777216 Jul 11 15:29 undo_001
  49. -rw-r----- 1 mysql mysql 16777216 Jul 11 15:29 undo_002
  50. [root@cent79-2 mysql]#

2.4.5.修改mysql密码

命令:

grep "password" /var/log/mysqld.log                                                               --查找初始密码
/usr/bin/mysqladmin -uroot -p'${old_passwd}' password '${new_passwd}'    --修改mysql密码

  1. [root@cent79-2 log]# grep "password" /var/log/mysqld.log
  2. 2023-07-11T07:29:44.693012Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: J%LdHu9HRse4
  3. [root@cent79-2 log]#
  4. [root@cent79-2 log]# /usr/bin/mysqladmin -uroot -p'J%LdHu9HRse4' password 'Root2#admin'
  5. mysqladmin: [Warning] Using a password on the command line interface can be insecure.
  6. Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
  7. [root@cent79-2 log]#

2.4.6.mysql登录验证

命令:

mysql -uroot -pRoot2#admin

  1. [root@cent79-2 log]# mysql -uroot -pRoot2#admin
  2. mysql: [Warning] Using a password on the command line interface can be insecure.
  3. Welcome to the MySQL monitor. Commands end with ; or \g.
  4. Your MySQL connection id is 10
  5. Server version: 8.0.33 MySQL Community Server - GPL
  6. Copyright (c) 2000, 2023, Oracle and/or its affiliates.
  7. Oracle is a registered trademark of Oracle Corporation and/or its
  8. affiliates. Other names may be trademarks of their respective
  9. owners.
  10. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  11. mysql>

2.4.7.mysql用户root密码更改

命令:

show variables like '%valid%';

  1. mysql> show variables like '%valid%';
  2. +--------------------------------------+--------+
  3. | Variable_name | Value |
  4. +--------------------------------------+--------+
  5. | innodb_validate_tablespace_paths | ON |
  6. | validate_password.check_user_name | ON |
  7. | validate_password.dictionary_file | |
  8. | validate_password.length | 8 |
  9. | validate_password.mixed_case_count | 1 |
  10. | validate_password.number_count | 1 |
  11. | validate_password.policy | MEDIUM |
  12. | validate_password.special_char_count | 1 |
  13. +--------------------------------------+--------+
  14. 8 rows in set (0.00 sec)
  15. mysql>

命令:

set global validate_password.check_user_name=OFF;

set global validate_password.policy=0;

set global validate_password.length=4;

flush privileges;

show variables like '%valid%';

  1. mysql> set global validate_password.check_user_name=OFF;
  2. Query OK, 0 rows affected (0.01 sec)
  3. mysql> set global validate_password.policy=0;
  4. Query OK, 0 rows affected (0.00 sec)
  5. mysql> set global validate_password.length=4;
  6. Query OK, 0 rows affected (0.00 sec)
  7. mysql> flush privileges;
  8. Query OK, 0 rows affected (0.01 sec)
  9. mysql> show variables like '%valid%';
  10. +--------------------------------------+-------+
  11. | Variable_name | Value |
  12. +--------------------------------------+-------+
  13. | innodb_validate_tablespace_paths | ON |
  14. | validate_password.check_user_name | OFF |
  15. | validate_password.dictionary_file | |
  16. | validate_password.length | 4 |
  17. | validate_password.mixed_case_count | 1 |
  18. | validate_password.number_count | 1 |
  19. | validate_password.policy | LOW |
  20. | validate_password.special_char_count | 1 |
  21. +--------------------------------------+-------+
  22. 8 rows in set (0.00 sec)

命令:

update user set authentication_string='' where user='root';
alter user 'root'@'localhost' identified with mysql_native_password by 'root';
flush privileges;
 

  1. mysql> update user set authentication_string='' where user='root';
  2. Query OK, 1 row affected (0.00 sec)
  3. Rows matched: 1 Changed: 1 Warnings: 0
  4. mysql> alter user 'root'@'localhost' identified with mysql_native_password by 'root';
  5. Query OK, 0 rows affected (0.00 sec)
  6. mysql> flush privileges;
  7. Query OK, 0 rows affected (0.00 sec)

退出验证:

命令:

exit

mysql -uroot -proot

  1. mysql> exit
  2. Bye
  3. [root@cent79-2 log]# mysql -uroot -pRoot2#admin
  4. mysql: [Warning] Using a password on the command line interface can be insecure.
  5. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
  6. [root@cent79-2 log]# mysql -uroot -proot
  7. mysql: [Warning] Using a password on the command line interface can be insecure.
  8. Welcome to the MySQL monitor. Commands end with ; or \g.
  9. Your MySQL connection id is 12
  10. Server version: 8.0.33 MySQL Community Server - GPL
  11. Copyright (c) 2000, 2023, Oracle and/or its affiliates.
  12. Oracle is a registered trademark of Oracle Corporation and/or its
  13. affiliates. Other names may be trademarks of their respective
  14. owners.
  15. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  16. mysql>

2.4.8.创建可登录的远程登录用户

命令:

create user 'root'@'%' identified with mysql_native_password by '${password};   --创建可登录的远程登录用户
grant all privileges on *.* to root@'%';                                                                           --授权
flush privileges;                                                                                                                --刷新

select host,user,plugin,authentication_string from mysql.user;

  1. mysql> create user 'root'@'%' identified with mysql_native_password by 'root';
  2. Query OK, 0 rows affected (0.00 sec)
  3. mysql> grant all privileges on *.* to root@'%';
  4. Query OK, 0 rows affected (0.00 sec)
  5. mysql> flush privileges;
  6. Query OK, 0 rows affected (0.00 sec)
  7. mysql> select host,user,plugin,authentication_string from mysql.user;
  8. +-----------+------------------+-----------------------+------------------------------------------------------------------------+
  9. | host | user | plugin | authentication_string |
  10. +-----------+------------------+-----------------------+------------------------------------------------------------------------+
  11. | % | root | mysql_native_password | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
  12. | localhost | mysql.infoschema | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
  13. | localhost | mysql.session | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
  14. | localhost | mysql.sys | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
  15. | localhost | root | mysql_native_password | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
  16. +-----------+------------------+-----------------------+------------------------------------------------------------------------+
  17. 5 rows in set (0.00 sec)
  18. mysql>

Navicat远程连接验证:

 至此,linux下mysql8.0.33安装已经完成。

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

闽ICP备14008679号