Home > Database > Mysql Tutorial > Mysql远程访问的开启_MySQL

Mysql远程访问的开启_MySQL

WBOY
Release: 2016-06-01 13:47:39
Original
774 people have browsed it

bitsCN.com

 Mysql默认是不可以通过远程机器访问的,通过下面的配置可以开启远程访问.

  我的Mysql环境是ubuntu+mysql5

  1.修改/etc/mysql/my.conf,修改bind-address,指定为本机实际IP地址,你的my.con修改完大概是如下的样子


  [mysqld]
  #
  # * Basic Settings
  #
  default-character-set=utf8
  default-storage-engine=INNODB
  bind-address    = 192.168.1.107
  user            = mysql
  pid-file        = /var/run/mysqld/mysqld.pid
  socket          = /var/run/mysqld/mysqld.sock
  port            = 3306
  basedir         = /usr
  datadir         = /var/lib/mysql
  tmpdir          = /tmp
  language        = /usr/share/mysql/english
  skip-external-locking


  2.用root登陆mysql执行如下命令


  grant all on sonardb.* to sonar@% identified by 123456;
  grant all on sonardb.* to sonar@localhost identified by 123456;


  sonardb替换为你想访问的数据库名,sonar是你的想使用的用户名,123456替换为你的密码,这样就开启了远程访问功能.

 

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template