当前位置:Gxlcms > 数据库问题 > CentOS 7安装Mysql并设置开机自启动

CentOS 7安装Mysql并设置开机自启动

时间:2021-07-01 10:21:17 帮助过:13人阅读

 1 Dependencies Resolved
 2 
 3 ================================================================================================================================================================
 4  Package                                                  Arch                 Version                  Repository                          Size
 5 ================================================================================================================================================================
 6 Installing:
 7  mysql-community-libs                                    x86_64              5.6.32-2.el7             mysql56-community                    2.0 M
 8  replacing  mariadb-libs.x86_64 1:5.5.47-1.el7_2
 9  mysql-community-server                                  x86_64              5.6.32-2.el7             mysql56-community                     59 M
10  Installing for dependencies:
11  mysql-community-client                                  x86_64              5.6.32-2.el7             mysql56-community                     19 M
12  mysql-community-common                                  x86_64              5.6.32-2.el7             mysql56-community                    256 k
13  perl-Compress-Raw-Bzip2                                 x86_64              2.061-3.el7              base                                  32 k
14  perl-Compress-Raw-Zlib                                  x86_64              1:2.061-4.el7            base                                  57 k
15  perl-DBI                                                x86_64              1.627-4.el7              base                                 802 k
16  perl-IO-Compress                                        noarch              2.061-2.el7              base                                 260 k
17  perl-Net-Daemon                                         noarch              0.48-5.el7               base                                  51 k
18  perl-PlRPC                                              noarch              0.2020-14.el7            base                                  36 k
19 
20 Transaction Summary
21 ================================================================================================================================================================
22 Install  2 Packages (+8 Dependent packages)
23 
24 Total download size: 82 M
25 Is this ok [y/d/N]: 
技术图片

3.yum install mysql-server即可。

可以看出,server和client都被选择安装。选择y,自动下载安装。

4. 安装完成后,启动Mysql。

systemctl start  mysqld.service

查看默认密码

[root@localhost 01]# cat /var/log/mysqld.log | grep password
2019-05-23T08:15:53.202062Z 1 [Note] A temporary password is generated for root@localhost: k=wh6S7-)3VH ##这个就是密码

 

5. 设置root密码。

登录进去后修改密码:https://www.cnblogs.com/Crazy-Liu/p/10912599.html

6. 开机自启动。

systemctl enable mysqld  ##centos7

 

CentOS 7安装Mysql并设置开机自启动

标签:release   emctl   rpc   ack   grep   generated   rpm安装   gen   end   

人气教程排行