Linux中怎么去关闭防护墙和mysql的无密码登陆及修改密码,做为一个自己参考的记录
CentOS 防火墙关闭
关闭防火墙命令:systemctl stop firewalld.service
开启防火墙:systemctl start firewalld.service
关闭开机自启动:systemctl disable firewalld.service
开启开机启动:systemctl enable firewalld.service
CentOS mysql 无密码登陆
my.cnf
文件增加 skip-grant-tables
路径 cd etc 打开my.cnf
在[mysqld] 下添加 skip-grant-tables 如图:
重新启动mysql服务
service mysqld restart
然后直接登陆即可。
登陆后在mysql里面修改密码:
修改mysql 密码 update user set password=password('你设置的密码') where User='root'
或者ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'
最后到etc/my.cnf 下删除 skip-grant-tables或者注释即可。