Linux下为MySQL配置添加新用户


在Linux下构建web应用时,需要远程访问MySQL数据库。

我们不推荐在Linux下使用root来登录,而是添加新用户。

1)以root用户登录
#mysql -u root -p

2)插入新用户,host:%;user:jason;pssword:jason
mysql>insert into mysql.user (host,user,password) values('%','jason',PASSWORD('jason'));

3)更新密码
mysql>update user set password=password('jason') where user='jason'

4)授予权限
mysql>grant all on neuzjs.* to jason@'%' identified by 'jason';
其中neuzjs为数据库名;

5)刷新权限
mysql>flush previleges; 

相关内容