方法一:
通过登录mysql系统, mysql -uroot -p Enter password: 【输入原来的密码】 mysql>use mysql; mysql> update user set authentication_string=passworD("test123") wher user='root'; mysql> flush privileges; mysql> exit;
方法二:
在mysql系统外,使用mysqladmin mysqladmin -u root -p password "test123" Enter password: 【输入原来的密码】
①.跳过密码启动
mysqld_safe --skip-grant-tables &
②.重设密码
# 直接输入mysql,进入mysql mysql mysql> use mysql; mysql> UPDATE user SET authentication_string=password("test123") WHERE user='root'; mysql> flush privileges; mysql> exit;
③.重新启动mysql
systemctl restart mysql
# password是数据库密码
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
firewall-cmd --list-all
[root@iZhp3di673f3rx1g5d9dfdZ soft]# firewall-cmd --list-all
public
target: default
icmp-block-inversion: no
interfaces:
sources:
services: dhcpv6-client ssh
ports: 20/tcp 21/tcp 22/tcp 80/tcp 8888/tcp 39000-40000/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
firewall-cmd --permanent --add-port=3306/tcp
service firewalld restart
firewall-cmd --query-port=3306/tcp
[root@iZhp3di673f3rx1g5d9dfdZ soft]# firewall-cmd --query-port=3306/tcp
yes
firewall-cmd --list-all
[root@iZhp3di673f3rx1g5d9dfdZ soft]# firewall-cmd --list-all
public
target: default
icmp-block-inversion: no
interfaces:
sources:
services: dhcpv6-client ssh
ports: 20/tcp 21/tcp 22/tcp 80/tcp 8888/tcp 39000-40000/tcp 3306/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
联系客服