首页 > 数据库技术 > 详细

Ubuntu14.04下如何开启Mysql远程访问

时间:2015-10-03 19:22:51      阅读:352      评论:0      收藏:0      [点我收藏+]

近来开发项目的需要,需要开启服务器下的Mysql远程访问权限(方法有很多),学习了一下,这里只演示个人觉得比较简单的一种方法。

对用户授权方法:

1. 在目录/etc/mysql下找到my.cnf,用vim编辑,找到my.cnf里面的   

bind-address           = 127.0.0.1

将其注释。如图:

技术分享

2. 然后用root登陆Mysql数据库。如图:

技术分享

3. 然后在mysql>这里输入:grant all on *.* to username@‘%‘ identified by ‘password;

注意:username是用户名,password是该用户名对应的的一个密码,例如:

grant all on *.* to zl@‘%‘ identified by ‘123456‘;,如图:

技术分享

4. 最后刷新一下。执行:flush privileges;如下图:

技术分享

5. 重启 MySQL,执行重启指令:sudo /etc/init.d/mysql restart

$> sudo /etc/init.d/mysql restart
* Starting MySQL database server mysqld
  ...done.
* Checking for corrupt, not cleanly closed and upgrade needing tables.
linuxidc@ubuntu:~$ sudo /etc/init.d/mysql start
* Starting MySQL database server mysqld
  ...done.

6. 最后就可以在远程用刚才创建的用户和密码登陆mysql。

Ubuntu14.04下如何开启Mysql远程访问

原文:http://www.cnblogs.com/longshiyVip/p/4853714.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!