centos7下yum安装mysql5.7

1. 安装wget,部分系统没有自带wget需要手动安装

shell > yum install wget

2. 查看系统有没有安装mysql服务,如果有卸载安装的mysql服务

shell> yum list installed mysql*

shell> yum remove mysql*

3. 下载mysql的yum源

shell > wget http://dev.mysql.com/get/ mysql57-community-release-el7-9.noarch.rpm

4. 安装mysql的yum源

shell> yum install mysql57-community-release-el7-9.noarch.rpm

5. 安装mysql

shell> yum install mysql-community-server mysql-community-client

6. 启动mysql服务

shell> systermctl mysqld start

7. 查看mysql初始密码

shell> cat /var/log/mysqld.log |grep password

8. 使用默认密码登录mysql

shell> mysql -uroot -p

9. 修改mysql初始密码

mysql> use mysql;

mysql> UPDATE user SET password=password("新密码") WHERE user='root';

或者

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';

10. 刷新权限表使之立即生效

mysql> flush privileges;

mysql> exit;

11. 开启mysql的远程登录(需要使用新密码登录)

mysql> use mysql;

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;

注:'%'代表任意地址都可登录,指定ip地址可以限制只能固定的ip登陆

 

转载于:https://my.oschina.net/fengxueyeduxing/blog/822503

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值