yum 源安装mysql8

yum 源安装mysql8

  • 下载安装包
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
  • 安装mysql的rpm包
yum -y install mysql80-community-release-el7-3.noarch.rpm
  • 安装mysql服务
yum install -y mysql-community-server --nogpgcheck   #--nogpgcheck,不检查gpg密钥
  • 启动服务& 设置自启动
systemctl start mysqld   #启动MySQL
systemctl enable mysqld		#开机自启MySQL
  • 查看初始密码
grep "password" /var/log/mysqld.log
  • 修改密码
sudo mysql_secure_installation     #设置密码
Enter password for user root:
#输入/var/log/mysqld.log中获得密码
New password:
#输入新的密码
Re-enter new password:
#重复输入新的密码
Change the password for root ? ((Press y|Y for Yes, any other key for No)
#是否想改变root的密码
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No)
#输入Y
Remove anonymous users? (Press y|Y for Yes, any other key for No)
#删除匿名用户
Disallow root login remotely? (Press y|Y for Yes, any other key for No)
#是否禁止远程登录
Remove test database and access to it? (Press y|Y for Yes, any other key for No)
#是否删除test数据库
Reload privilege tables now? (Press y|Y for Yes, any other key for No)
#是否刷新权限
  • 密码规则
SHOW VARIABLES LIKE 'validate_password%';       #查看有哪些密码策略

SET GLOBAL validate_password.policy= 0;       #密码复杂度设置为低    1为中  2为高

set global validate_password.length = 6;    #设置密码长度为6

ALTER USER 'root'@'localhost' IDENTIFIED BY '密码';    # 再次修改密码

create user root@"%" identified by "密码";      #允许root用户远程连接

grant all privileges on *.* to root@"%" with grant option;#为新用户赋权 
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值