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');