mysql密码相关常用命令

1.启动命令

[hadoop@node2 mysql]$sudo systemctl start mysqld;
[hadoop@node2 mysql]$ systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2022-05-24 05:30:14 EDT; 23s ago
  Process: 1756 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 1683 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 1759 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─1759 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

2.查看原始密码

[hadoop@node2 mysql]$ sudo cat /var/log/mysqld.log | grep password
2022-05-24T09:30:07.710889Z 1 [Note] A temporary password is generated for root@localhost: OdHD-dGb=5fW

3.登录mysql:

mysql -uroot -p'OdHD-dGb=5fW'

4.先设置一个复杂密码

set password = password("Qs23=zs32");

5.修改mysql密码策略(修改密码长度为4,密码难度等级为最低)

set global validate_password_length=4;
set global validate_password_policy=0;

6.设置简单密码

set password=password('000000');

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值