美文网首页
MySQL数据库开启远程连接(云服务器ubuntu)

MySQL数据库开启远程连接(云服务器ubuntu)

作者: sssnowyue | 来源:发表于2017-07-11 23:56 被阅读7次

    1、配置安全组

    控制台>>>配置安全组>>>默认安全组放通全部端口

    </br>
    </br>

    2、用户切换到root

    </br>
    </br>

    3、安装MySQL

    apt-get install mysql-server
    apt-get isntall mysql-client
    apt-get install libmysqlclient-dev
    

    </br>
    </br>

    4、暂停服务MySQL

    service mysql stop
    

    </br>
    </br>

    5、配置MySQL

    (1)使用 vim 打开 mysqld.cnf

    vim /etc/mysql/mysql.conf.d/mysqld.cnf
    

    (2)将 bind-address = 127.0.0.1 注释

    # bind-address = 127.0.0.1
    

    </br>
    </br>

    6、启动服务MySQL

    service mysql start
    

    </br>
    </br>

    7、授权<远程访问>

    *.*:第一个*代表数据库名,第二个*代表表名
    root:授予root账号
    “%”:授权的用户IP,这里代表任意的IP地址都能访问MySQL数据库
    “password”:mysql root帐号密码
    mysql>grant all privileges on *.* to root@"%" identified by "password" with grant option;
    

    相关文章

      网友评论

          本文标题:MySQL数据库开启远程连接(云服务器ubuntu)

          本文链接:https://www.haomeiwen.com/subject/djsvhxtx.html