linux mysql運維一些常用記錄 //停止mysql # service mysqld stop //安全模式啟動mysql,跳過權限檢查 # mysqld_safe --user=mysql --skip-grant-tables & //登入mysql控制台 mysql //修改所有root的密碼 mysql> update user set password=password('newpassword') where user='root'; //刷新授權 mysql> flush privileges; //退出 mysql> quit //重新啟動mysql # service mysqld restart //給192.168.248.71上root 用戶賦權所有數據庫 mysql> grant all privileges on *.* to 'root'@'192.168.248.71' identified by 'root' with grant option; //設置防火牆允許3306端口 # vi /etc/sysconfig/iptables 添加 -A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT //重啟防火牆 # service iptables restart