当前位置:   article > 正文

centos7上安装mysql8.0_error: package: mysql-community-server-8.0.36-1.el

error: package: mysql-community-server-8.0.36-1.el8.x86_64 (mysql80-communit

1 yum安装

官网yum安装方法

 

 

1.1 获取MySQL8.0 YUM源

进入mysql官网获取RPM包下载地址,上面截图已经给出操作步骤

  1. # 获取到下载链接:
  2. https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm

1.2 下载和安装mysql源

  1. 下载mysql源
  2. wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
  3. 安装mysql源
  4. yum -y localinstall mysql80-community-release-el7-1.noarch.rpm

1.3 在线安装MySQL

 yum -y install mysql-community-server

安装过程,安装时间比较长,由网速决定。

  1. [root@wyl01 ~]# yum -y install mysql-community-server
  2. Loaded plugins: fastestmirror, langpacks
  3. Determining fastest mirrors
  4. * base: mirrors.aliyun.com
  5. * extras: mirrors.aliyun.com
  6. * updates: mirrors.aliyun.com
  7. (1/2): mysql-connectors-community/x86_64/primary_db | 37 kB 00:00:00
  8. mysql-tools-community/x86_64/p FAILED
  9. http://repo.mysql.com/yum/mysql-tools-community/el/7/x86_64/repodata/5f5c8d66d01cebe1ed0fdd8710b411b96b9161c1-primary.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to repo.mysql.com:80; Connection refused"
  10. Trying other mirror.
  11. mysql-tools-community/x86_64/p FAILED
  12. http://repo.mysql.com/yum/mysql-tools-community/el/7/x86_64/repodata/5f5c8d66d01cebe1ed0fdd8710b411b96b9161c1-primary.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to repo.mysql.com:80; Connection refused"
  13. Trying other mirror.
  14. mysql-tools-community/x86_64/p FAILED
  15. http://repo.mysql.com/yum/mysql-tools-community/el/7/x86_64/repodata/5f5c8d66d01cebe1ed0fdd8710b411b96b9161c1-primary.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to repo.mysql.com:80; Connection refused"
  16. Trying other mirror.
  17. (2/2): mysql-tools-community/x86_64/primary_db | 54 kB 00:00:00
  18. Resolving Dependencies
  19. --> Running transaction check
  20. ---> Package mysql-community-server.x86_64 0:8.0.15-1.el7 will be installed
  21. --> Processing Dependency: mysql-community-common(x86-64) = 8.0.15-1.el7 for package: mysql-community-server-8.0.15-1.el7.x86_64
  22. --> Processing Dependency: mysql-community-client(x86-64) >= 8.0.0 for package: mysql-community-server-8.0.15-1.el7.x86_64
  23. --> Running transaction check
  24. ---> Package mysql-community-client.x86_64 0:8.0.15-1.el7 will be installed
  25. --> Processing Dependency: mysql-community-libs(x86-64) >= 8.0.0 for package: mysql-community-client-8.0.15-1.el7.x86_64
  26. ---> Package mysql-community-common.x86_64 0:8.0.15-1.el7 will be installed
  27. --> Running transaction check
  28. ---> Package mariadb-libs.x86_64 1:5.5.52-1.el7 will be obsoleted
  29. --> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
  30. --> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
  31. ---> Package mysql-community-libs.x86_64 0:8.0.15-1.el7 will be obsoleting
  32. --> Running transaction check
  33. ---> Package mysql-community-libs-compat.x86_64 0:8.0.15-1.el7 will be obsoleting
  34. ---> Package postfix.x86_64 2:2.10.1-6.el7 will be updated
  35. ---> Package postfix.x86_64 2:2.10.1-7.el7 will be an update
  36. --> Finished Dependency Resolution
  37. Dependencies Resolved
  38. ====================================================================================================================================
  39. Package Arch Version Repository Size
  40. ====================================================================================================================================
  41. Installing:
  42. mysql-community-libs x86_64 8.0.15-1.el7 mysql80-community 2.2 M
  43. replacing mariadb-libs.x86_64 1:5.5.52-1.el7
  44. mysql-community-libs-compat x86_64 8.0.15-1.el7 mysql80-community 2.1 M
  45. replacing mariadb-libs.x86_64 1:5.5.52-1.el7
  46. mysql-community-server x86_64 8.0.15-1.el7 mysql80-community 360 M
  47. Installing for dependencies:
  48. mysql-community-client x86_64 8.0.15-1.el7 mysql80-community 25 M
  49. mysql-community-common x86_64 8.0.15-1.el7 mysql80-community 566 k
  50. Updating for dependencies:
  51. postfix x86_64 2:2.10.1-7.el7 base 2.4 M
  52. Transaction Summary
  53. ====================================================================================================================================
  54. Install 3 Packages (+2 Dependent packages)
  55. Upgrade ( 1 Dependent package)
  56. Total size: 393 M
  57. Total download size: 391 M
  58. Downloading packages:

1.4 启动mysql服务

  1. #启动mysql服务
  2. systemctl start mysqld
  3. #查看进程
  4. ps -ef |grep mysql
  5. systemd+ 3649 1 0 Feb16 ? 01:34:00 mysqld
  6. root 4097 3649 0 Feb16 ? 00:00:00 [mysql] <defunct>
  7. mysql 84152 1 11 15:15 ? 00:00:01 /usr/sbin/mysqld
  8. #设置开机自启动
  9. systemctl enable mysqld

1.5 修改root登陆密码,可远程连接

mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个临时的默认密码,用grep命令搜一下。

  1. [root@wyl01 local]# grep -R "password" /var/log/mysqld.log
  2. 2019-02-27T07:15:07.717147Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: h80yjbjIjL*y

进入mysql服务后,我们查看数据库操作,发现下面的错误信息

  1. [root@wyl01 ~]# mysql -uroot -ph80yjbjIjL*y
  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 8
  5. Server version: 8.0.15
  6. Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  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> show databases;
  12. ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
  13. mysql>

提示我们需要先修改密码,这里的修改密码方式和之前的版本不同,密码的长度和密码的要求也不一样,这里至少包含大小写字母数字和特殊字符。

alter user 'root'@'localhost' identified by 'QWer12#$';

修改完密码后,我们的本地远程访问还是不行的,我们查看一下原因

所以我们要将host=‘localhost’改成‘%’

  1. update mysql.user set host='%' where user='root';
  2. flush privileges;

至此,我们mysql8.0版本安装结束。

 

2 二进制包安装

2.1 下载安装包

下载地址

2.2 安装方法和mysql5.7安装方法一样

mysql5.7安装步骤

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

闽ICP备14008679号