create user 'testuser'@'localhost' IDENTIFIED BY 'testpass'; //新建用户
grant all privileges on blog.* to testuser@localhost identified by 'testpass'; //授权用户登录blog数据库
GRANT ALL PRIVILEGES ON *.* TO testuser@"%" IDENTIFIED BY "testpass"; //授权用户能远程连接mysql
GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "123456";
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass'); //设置root密码
flush privileges;
-----------------------------------------------------------------------------------------
如果连接不上,请注意设置iptables放行端口