mysql设置远程连接

    技术2025-01-26  13

    use mysql; select host, user, authentication_string, plugin from user; CREATE USER ‘root’@’%’ IDENTIFIED BY ‘root’; set global validate_password.policy=0;

    set global validate_password.length=1; ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘root’; GRANT ALL PRIVILEGES ON . TO ‘root’@’%’; flush privileges; 添加端口:firewall-cmd --zone=public --add-port=3306/tcp --permanent

    重载防火墙:firewall-cmd --reload 重启服务 systemctl stop mysqld.service systemctl start mysqld.service

    Processed: 0.012, SQL: 9