赞
踩
进入mysql官网获取RPM包下载地址,上面截图已经给出操作步骤
- # 获取到下载链接:
- https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
- 下载mysql源
- wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
-
- 安装mysql源
- yum -y localinstall mysql80-community-release-el7-1.noarch.rpm
yum -y install mysql-community-server
安装过程,安装时间比较长,由网速决定。
- [root@wyl01 ~]# yum -y install mysql-community-server
- Loaded plugins: fastestmirror, langpacks
- Determining fastest mirrors
- * base: mirrors.aliyun.com
- * extras: mirrors.aliyun.com
- * updates: mirrors.aliyun.com
- (1/2): mysql-connectors-community/x86_64/primary_db | 37 kB 00:00:00
- mysql-tools-community/x86_64/p FAILED
- 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"
- Trying other mirror.
- mysql-tools-community/x86_64/p FAILED
- 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"
- Trying other mirror.
- mysql-tools-community/x86_64/p FAILED
- 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"
- Trying other mirror.
- (2/2): mysql-tools-community/x86_64/primary_db | 54 kB 00:00:00
- Resolving Dependencies
- --> Running transaction check
- ---> Package mysql-community-server.x86_64 0:8.0.15-1.el7 will be installed
- --> Processing Dependency: mysql-community-common(x86-64) = 8.0.15-1.el7 for package: mysql-community-server-8.0.15-1.el7.x86_64
- --> Processing Dependency: mysql-community-client(x86-64) >= 8.0.0 for package: mysql-community-server-8.0.15-1.el7.x86_64
- --> Running transaction check
- ---> Package mysql-community-client.x86_64 0:8.0.15-1.el7 will be installed
- --> Processing Dependency: mysql-community-libs(x86-64) >= 8.0.0 for package: mysql-community-client-8.0.15-1.el7.x86_64
- ---> Package mysql-community-common.x86_64 0:8.0.15-1.el7 will be installed
- --> Running transaction check
- ---> Package mariadb-libs.x86_64 1:5.5.52-1.el7 will be obsoleted
- --> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
- --> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
- ---> Package mysql-community-libs.x86_64 0:8.0.15-1.el7 will be obsoleting
- --> Running transaction check
- ---> Package mysql-community-libs-compat.x86_64 0:8.0.15-1.el7 will be obsoleting
- ---> Package postfix.x86_64 2:2.10.1-6.el7 will be updated
- ---> Package postfix.x86_64 2:2.10.1-7.el7 will be an update
- --> Finished Dependency Resolution
-
- Dependencies Resolved
-
- ====================================================================================================================================
- Package Arch Version Repository Size
- ====================================================================================================================================
- Installing:
- mysql-community-libs x86_64 8.0.15-1.el7 mysql80-community 2.2 M
- replacing mariadb-libs.x86_64 1:5.5.52-1.el7
- mysql-community-libs-compat x86_64 8.0.15-1.el7 mysql80-community 2.1 M
- replacing mariadb-libs.x86_64 1:5.5.52-1.el7
- mysql-community-server x86_64 8.0.15-1.el7 mysql80-community 360 M
- Installing for dependencies:
- mysql-community-client x86_64 8.0.15-1.el7 mysql80-community 25 M
- mysql-community-common x86_64 8.0.15-1.el7 mysql80-community 566 k
- Updating for dependencies:
- postfix x86_64 2:2.10.1-7.el7 base 2.4 M
-
- Transaction Summary
- ====================================================================================================================================
- Install 3 Packages (+2 Dependent packages)
- Upgrade ( 1 Dependent package)
-
- Total size: 393 M
- Total download size: 391 M
- Downloading packages:
- #启动mysql服务
- systemctl start mysqld
-
- #查看进程
- ps -ef |grep mysql
- systemd+ 3649 1 0 Feb16 ? 01:34:00 mysqld
- root 4097 3649 0 Feb16 ? 00:00:00 [mysql] <defunct>
- mysql 84152 1 11 15:15 ? 00:00:01 /usr/sbin/mysqld
-
-
- #设置开机自启动
- systemctl enable mysqld
mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个临时的默认密码,用grep命令搜一下。
- [root@wyl01 local]# grep -R "password" /var/log/mysqld.log
- 2019-02-27T07:15:07.717147Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: h80yjbjIjL*y
进入mysql服务后,我们查看数据库操作,发现下面的错误信息
- [root@wyl01 ~]# mysql -uroot -ph80yjbjIjL*y
- mysql: [Warning] Using a password on the command line interface can be insecure.
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 8
- Server version: 8.0.15
-
- Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
-
- Oracle is a registered trademark of Oracle Corporation and/or its
- affiliates. Other names may be trademarks of their respective
- owners.
-
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
-
- mysql> show databases;
- ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
- mysql>
提示我们需要先修改密码,这里的修改密码方式和之前的版本不同,密码的长度和密码的要求也不一样,这里至少包含大小写字母数字和特殊字符。
alter user 'root'@'localhost' identified by 'QWer12#$';
修改完密码后,我们的本地远程访问还是不行的,我们查看一下原因
所以我们要将host=‘localhost’改成‘%’
- update mysql.user set host='%' where user='root';
- flush privileges;
至此,我们mysql8.0版本安装结束。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。