Ubuntu 設(shè)置開放 MySQL 服務(wù)遠(yuǎn)程訪問教程

字號:


    第一步,修改配置文件:
    vim /etc/mysql/my.cnf
    找到
    bind-address = 127.0.0.1
    改為:
    bind-address = 0.0.0.0
    #允許任意ip地址訪問
    也可以指定IP地址。
    重啟MySQL:
    sudo /etc/init.d/mysqld restart
    第二步,修改數(shù)據(jù)庫配置:
    授權(quán)root用戶進(jìn)行遠(yuǎn)程連接
    grant all privileges on *.* to" identified by "password" with grant option;
    flush privileges;
    第二行命令使設(shè)置生效。