CentOS 7 Linux 中Yum方式安装MySQL(咋个办呢 zgbn)

CentOS 7 Linux 中Yum方式安装MySQL

使用yum方式安装mysql,首选看官网是否支持yum安装支持。
https://dev.mysql.com/downloads/repo/yum/
显然官网是支持的。

并且给出了安装步骤。

添加yum资源库(Adding the MySQL Yum Repository)

访问 https://dev.mysql.com/downloads/repo/yum/ 页面,下载对应的rpm包。
这里写图片描述

在服务器端下载rpm包

]# wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm

安装mysql yum 资源

]# rpm -Uvh mysql57-community-release-el7-11.noarch.rpm 
warning: mysql57-community-release-el7-11.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql57-community-release-el7-11 ################################# [100%]

查看yum mysql资源包

]# yum repolist all | grep mysql

修改yum资源,选择mysql版本。
/etc/yum.repos.d/mysql-community.repo

安装MySQL(Installing MySQL)

命令

]# yum install mysql-community-server

查看

]# rpm -ql mysql-community-server

启动MySQL服务(Starting the MySQL Server)

命令

]# service mysqld start

查看

]# ps -ef | grep mysqld

修改默认root用户密码

查看默认密码

]# grep 'temporary password' /var/log/mysqld.log
2017-12-17T12:21:23.735081Z 1 [Note] A temporary password is generated for root@localhost: #vdU,E<Kz6*I
#vdU,E<Kz6*I 为默认密码。

root用户登录MySQL服务修改密码

]# mysql -uroot -p
Enter password: 密码

修改密码

#修改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
#添加超级用户
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'x.x.x.x' IDENTIFIED BY 'Password' WITH GRANT OPTION;

完成

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值