1,cd   /usr/local/software   这个目录下面

2,wget -i -c https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm    下载mysql8.0的rpm

Mysql8在Centos7.2上面安装

3,yum -y install mysql-community-server  安装mysql  ,下面是安装日志,此过程可能比较耗时,需要下载的东西比较多,建议在网络好的时候操作

[[email protected] software]# yum -y install mysql-community-server
已加载插件:fastestmirror
base                                                                                                                                                                                            | 3.6 kB  00:00:00     
extras                                                                                                                                                                                          | 3.4 kB  00:00:00     
mysql-connectors-community                                                                                                                                                                      | 2.5 kB  00:00:00     
mysql-tools-community                                                                                                                                                                           | 2.5 kB  00:00:00     
mysql80-community                                                                                                                                                                               | 2.5 kB  00:00:00     
nginx                                                                                                                                                                                           | 2.9 kB  00:00:00     
updates                                                                                                                                                                                         | 3.4 kB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.163.com
 * updates: mirrors.huaweicloud.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql-community-server.x86_64.0.8.0.13-1.el7 将被 安装
--> 正在处理依赖关系 mysql-community-common(x86-64) = 8.0.13-1.el7,它被软件包 mysql-community-server-8.0.13-1.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-client(x86-64) >= 8.0.0,它被软件包 mysql-community-server-8.0.13-1.el7.x86_64 需要
--> 正在处理依赖关系 net-tools,它被软件包 mysql-community-server-8.0.13-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mysql-community-client.x86_64.0.8.0.13-1.el7 将被 安装
--> 正在处理依赖关系 mysql-community-libs(x86-64) >= 8.0.0,它被软件包 mysql-community-client-8.0.13-1.el7.x86_64 需要
---> 软件包 mysql-community-common.x86_64.0.8.0.13-1.el7 将被 安装
---> 软件包 net-tools.x86_64.0.2.0-0.22.20131004git.el7 将被 安装
--> 正在检查事务
---> 软件包 mariadb-libs.x86_64.1.5.5.44-2.el7.centos 将被 取代
--> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 2:postfix-2.10.1-6.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 2:postfix-2.10.1-6.el7.x86_64 需要
---> 软件包 mysql-community-libs.x86_64.0.8.0.13-1.el7 将被 舍弃
--> 正在检查事务
---> 软件包 mysql-community-libs-compat.x86_64.0.8.0.13-1.el7 将被 舍弃
--> 解决依赖关系完成

依赖关系解决

=======================================================================================================================================================================================================================
 Package                                                     架构                                   版本                                                       源                                                 大小
=======================================================================================================================================================================================================================
正在安装:
 mysql-community-libs                                        x86_64                                 8.0.13-1.el7                                               mysql80-community                                 2.3 M
      替换  mariadb-libs.x86_64 1:5.5.44-2.el7.centos
 mysql-community-libs-compat                                 x86_64                                 8.0.13-1.el7                                               mysql80-community                                 2.1 M
      替换  mariadb-libs.x86_64 1:5.5.44-2.el7.centos
 mysql-community-server                                      x86_64                                 8.0.13-1.el7                                               mysql80-community                                 381 M
为依赖而安装:
 mysql-community-client                                      x86_64                                 8.0.13-1.el7                                               mysql80-community                                  26 M
 mysql-community-common                                      x86_64                                 8.0.13-1.el7                                               mysql80-community                                 554 k
 net-tools                                                   x86_64                                 2.0-0.22.20131004git.el7                                   base                                              305 k

事务概要
=======================================================================================================================================================================================================================
安装  3 软件包 (+3 依赖软件包)

总计:412 M
总下载量:381 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
警告:/var/cache/yum/x86_64/7/mysql80-community/packages/mysql-community-server-8.0.13-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, ** ID 5072e1f5: NOKEY===========================-] 6.7 MB/s | 380 MB  00:00:00 ETA 
mysql-community-server-8.0.13-1.el7.x86_64.rpm 的公钥尚未安装
mysql-community-server-8.0.13-1.el7.x86_64.rpm                                                                                                                                                  | 381 MB  00:00:33     
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 检索**
导入 GPG key 0x5072E1F5:
 用户ID     : "MySQL Release Engineering <[email protected]>"
 指纹       : a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 软件包     : mysql80-community-release-el7-1.noarch (@/mysql80-community-release-el7-1.noarch)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : mysql-community-common-8.0.13-1.el7.x86_64                                                                                                                                                         1/7 
  正在安装    : mysql-community-libs-8.0.13-1.el7.x86_64                                                                                                                                                           2/7 
  正在安装    : mysql-community-client-8.0.13-1.el7.x86_64                                                                                                                                                         3/7 
  正在安装    : net-tools-2.0-0.22.20131004git.el7.x86_64                                                                                                                                                          4/7 
  正在安装    : mysql-community-server-8.0.13-1.el7.x86_64                                                                                                                                                         5/7 
  正在安装    : mysql-community-libs-compat-8.0.13-1.el7.x86_64                                                                                                                                                    6/7 
  正在删除    : 1:mariadb-libs-5.5.44-2.el7.centos.x86_64                                                                                                                                                          7/7 
  验证中      : net-tools-2.0-0.22.20131004git.el7.x86_64                                                                                                                                                          1/7 
  验证中      : mysql-community-libs-compat-8.0.13-1.el7.x86_64                                                                                                                                                    2/7 
  验证中      : mysql-community-libs-8.0.13-1.el7.x86_64                                                                                                                                                           3/7 
  验证中      : mysql-community-common-8.0.13-1.el7.x86_64                                                                                                                                                         4/7 
  验证中      : mysql-community-server-8.0.13-1.el7.x86_64                                                                                                                                                         5/7 
  验证中      : mysql-community-client-8.0.13-1.el7.x86_64                                                                                                                                                         6/7 
  验证中      : 1:mariadb-libs-5.5.44-2.el7.centos.x86_64                                                                                                                                                          7/7 

已安装:
  mysql-community-libs.x86_64 0:8.0.13-1.el7                          mysql-community-libs-compat.x86_64 0:8.0.13-1.el7                          mysql-community-server.x86_64 0:8.0.13-1.el7                         

作为依赖被安装:
  mysql-community-client.x86_64 0:8.0.13-1.el7                           mysql-community-common.x86_64 0:8.0.13-1.el7                           net-tools.x86_64 0:2.0-0.22.20131004git.el7                          

替代:
  mariadb-libs.x86_64 1:5.5.44-2.el7.centos                                                                                                                                                                            

完毕!

4,启动mysql     systemctl status mysqld.service   看到下面日志代表正常启动

● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
[[email protected] software]# systemctl start mysqld.service
[[email protected] software]# systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since 四 2018-11-01 07:06:00 CST; 2s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 2415 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 2483 (mysqld)
   Status: "SERVER_OPERATING"
   CGroup: /system.slice/mysqld.service
           └─2483 /usr/sbin/mysqld

11月 01 07:05:50 localhost.localdomain systemd[1]: Starting MySQL Server...
11月 01 07:06:00 localhost.localdomain systemd[1]: Started MySQL Server.

5,查找初始密码    grep "password"  /var/log/mysqld.log

Mysql8在Centos7.2上面安装

6,使用初始密码登录  mysql -uroot -p

Mysql8在Centos7.2上面安装

7,修改root用户密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Password';//密码规则要按照要求

8,修改语句 将root用户的localhost修改成为%

update user set host = '%' where user = 'root';

9,重新授权 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';

10,刷新权限 flush privileges;

Mysql8在Centos7.2上面安装

11,为了可以让虚拟机外面的界面工具可以访问

编辑:vi /etc/my.cnf

放开前面的#号  default-authentication-plugin=mysql_native_password

Mysql8在Centos7.2上面安装

12,连接

Mysql8在Centos7.2上面安装

相关文章:

  • 2021-07-14
  • 2021-06-07
  • 2022-12-23
  • 2021-12-19
  • 2022-03-10
  • 2022-01-21
  • 2022-01-19
  • 2022-12-23
猜你喜欢
  • 2021-11-16
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
  • 2021-12-17
  • 2021-12-18
相关资源
相似解决方案