方法一:
經過登陸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 &html
②.重設密碼
# 直接輸入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 mysqlmysql
# password是數據庫密碼 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION; FLUSH PRIVILEGES;
firewall-cmd --list-allsql
[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/tcpshell
service firewalld restart數據庫
firewall-cmd --query-port=3306/tcpssh
[root@iZhp3di673f3rx1g5d9dfdZ soft]# firewall-cmd --query-port=3306/tcp yes
firewall-cmd --list-alltcp
[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:
https://blog.csdn.net/qq_35070711/article/details/70860014.net