centOS下mysql更改密码以及设置远程连接

一、更改root 用户密码


mysql -u root -p

use mysql

UPDATE user SET Password = PASSWORD('newpassword') WHERE user = 'root';

FLUSH PRIVILEGES;

二、设置远程连接

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

FLUSH PRIVILEGES;

iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

你可能感兴趣的:(centOS下mysql更改密码以及设置远程连接)