MySQL怎样授权用户远程访问数据库

By admin, 13 三月, 2015

1. 运行SQL语句授权用户

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password'

2. 编辑/etc/mysql/my.cnf,把bind-address = 127.0.0.1注释掉

3. 重启MySQL服务

service mysql restart

 

如果用户还需要拥有授权其他用户的权限,则需要用下面的命令(把%换成IP),用户要退出重新登录mysql才能生效:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' with grant option

标签

评论

Restricted HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img src>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。
验证码
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
请输入"Drupal10"