MySQL: How to allow remote connection to mysql

后端 未结 16 1179
北海茫月
北海茫月 2020-11-21 06:15

I have installed MySQL Community Edition 5.5 on my local machine and I want to allow remote connections so that I can connect from external source.

How can I do that

16条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-21 07:11

    All process for remote login. Remote login is off by default.You need to open it manually for all ip..to give access all ip

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';
    

    Specific Ip

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'your_desire_ip' IDENTIFIED BY 'password';
    

    then

    flush privileges;
    

    You can check your User Host & Password

    SELECT host,user,authentication_string FROM mysql.user;
    

    Now your duty is to change this

    bind-address = 127.0.0.1
    

    You can find this on

    sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
    
    

    if you not find this on there then try this

    sudo nano /etc/mysql/my.cnf
    

    comment in this

    #bind-address = 127.0.0.1
    

    Then restart Mysql

    sudo service mysql restart
    

    Now enjoy remote login

提交回复
热议问题