CentOS7安装mysql8.0.12版本

1、下载MySQL源安装包并安装

MySQL源安装包下载链接

[root@ chenc01 ~]# wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
[root@ chenc01 ~]# yum localinstall mysql80-community-release-el7-1.noarch.rpm

2、检查是否安装成功

[root@ chenc01 ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community                 141
mysql-tools-community/x86_64      MySQL Tools Community                      105
mysql80-community/x86_64          MySQL 8.0 Community Server                 161

3、安装mysql

[root@ chenc01 ~]# yum -y install mysql-community-server
Loaded plugins: fastestmirror
base                                                                                 | 3.6 kB  00:00:00     
epel                                                                                 | 5.3 kB  00:00:00     
extras                                                                               | 2.9 kB  00:00:00     
mysql-connectors-community                                                           | 2.5 kB  00:00:00     
mysql-tools-community                                                                | 2.5 kB  00:00:00     
mysql55-community                                                                    | 2.5 kB  00:00:00     
updates                                                                              | 2.9 kB  00:00:00     
mysql55-community/x86_64/primary_db                                                  | 183 kB  00:00:00     
Loading mirror speeds from cached hostfile

4、启动mysql服务

1)启动
[root@ chenc01 ~]# systemctl start mysqld
2)查看启动状态
[root@ chenc01 ~]# systemctl status mysqld
● mysqld.service - MySQL Community Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2020-03-16 18:17:59 CST; 39s ago
  Process: 2003 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
  Process: 1949 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 2002 (mysqld_safe)
   CGroup: /system.slice/mysqld.service
           ├─2002 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           └─2161 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/...
3)设置开机启动
[root@ chenc01 ~]# systemctl enable mysqld
Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mysqld.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mysqld.service to /usr/lib/systemd/system/mysqld.service.
4)启动MySQL

注意MySQL8.0.19 的登录密码是自动生成的!

[root@ chenc01 ~]# grep 'temporary password' /var/log/mysqld.log
2020-03-16T10:33:27.273294Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: eRxeGx_AO5nZ
[root@ chenc01 ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.19

Copyright (c) 2000, 2020, 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> 
5)修改MySQL登录密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'TestBicon@123';
Query OK, 0 rows affected (0.01 sec)
mysql> 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值