Home  >  Article  >  Database  >  Opening of Mysql remote access

Opening of Mysql remote access

高洛峰
高洛峰Original
2016-12-02 14:03:22940browse

 Mysql cannot be accessed through remote machines by default. Remote access can be enabled through the following configuration.

 My Mysql environment is ubuntu+mysql5

 1. Modify /etc/mysql/my.conf, modify bind-address, Designated as the actual IP address of this machine, your my.con will probably look like the following after modification


  [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/mysq ld/mysqld.sock
 port     =3306
 basedir    =/usr
 datadir     =/var/lib/mysql
  tmpdir     =//tmp
  language    =/usr/share/mysql/english
 skip-external-locking


  2. Log in to mysql with root Execute the following command


 grant all onsonardb .* to sonar@'%' identified by '123456';
grant all on sonardb. Username, replace 123456 with your password, thus enabling the remote access function.


Statement:
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