Heim  >  Artikel  >  Datenbank  >  Linux下为MySQL配置添加新用户

Linux下为MySQL配置添加新用户

WBOY
WBOYOriginal
2016-06-07 16:51:301985Durchsuche

在Linux下构建web应用时,需要远程访问MySQL数据库。我们不推荐在Linux下使用root来登录,而是添加新用户。1)以root用户登录#mysql -u root

在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; 

linux

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn