linux下装mysql

[root@gree135 ~]# cd /etc/sysconfig/network-scripts/
[root@gree135 network-scripts]# vi ./ifcfg-ens33 
    BOOTPROTO=static
    IPADDR=192.168.153.135
    GATEWAY=192.168.153.2
    NETMASK=255.255.255.0
    DNS1=8.8.8.8
    
[root@gree135 ~]# systemctl restart network.service


[root@gree135 ~]# yum install -y wget

[root@gree135 ~]# wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

[root@gree135 ~]# yum localinstall mysql57-community-release-el7-8.noarch.rpm

[root@gree135 ~]# yum install mysql-community-server

[root@gree135 ~]# systemctl start mysqld
[root@gree135 ~]# systemctl enable mysqld
[root@gree135 ~]# systemctl daemon-reload
[root@gree135 ~]# systemctl stop firewalld
[root@gree135 ~]# systemctl disable firewalld
[root@gree135 ~]# grep 'temporary password' /var/log/mysqld.log 
2021-10-08T03:21:28.093080Z 1 [Note] A temporary password is generated for root@localhost: 2qdMM&vmgRTB

[root@gree135 ~]# mysql -uroot -p
Enter password:

#设置密码报错,密码不符合安全等级
mysql> alter user 'root'@'localhost' identified by 'root';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

#设置mysql密码安全等级
mysql> set global validate_password_length=4;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)

#重新设置密码成功
mysql> alter user 'root'@'localhost' identified by 'root';
Query OK, 0 rows affected (0.00 sec)

# exit退出重新登陆,使用新密码

#设置远程登陆
mysql> grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值