ubuntu mysqlサーバリモートアクセスを開始

1372 ワード

ubuntu mysqlサーバリモートアクセスを開始
 
1.ubuntuインストールmysql
$ sudo apt-get install mysql-server mysql-client

 
2.rootユーザーへのリモートアクセス権限
$ mysql -uroot -p

パスワード入力後
mysql> GRANT ALL PRIVILEGES ON *.* TO root@'%' Identified by "fztree";

 
説明
     
    :grant    on    .* to    @     identified by "  "
   ,      user1   password1,          ,           、  、  、     。
      root    mysql,        :
  grant select,insert,update,delete on *.* to user1@localhost Identified by "password1";
                   mysql,  localhost  "%"。
       user1   ,             。
  grant select,insert,update,delete on mydb.* to user1@localhost identified by "";
                
  grant select,insert,update,delete on *.* to user1@localhost;
  
  http://www.cnblogs.com/good_hans/archive/2010/03/29/1700046.html

 
3.プロファイルを修正し、127.0.0.1を解除する
$ sudo vi  /etc/mysql/my.cnf

bind-address=127.0.0.1を見つけます
bind-address=0.0.0.0に変更
 
4.mysqlサーバの再起動
$ sudo ufw allow mysql
$ sudo service mysql restart