美文网首页
mysql开启远程访问权限

mysql开启远程访问权限

作者: 奋斗_登 | 来源:发表于2017-07-02 23:40 被阅读19次

    1.

    //登录数据库

    mysql -u root -pvmwaremysql>use mysql;

    //%为所有ip都可以远程访问

    mysql>update user set host = '%' where user = 'root';

    //或直接添加一条语句也行

    mysql>insert into user (host,user,password) values('192.168.0.51','root',password('123'));

    //查看一下修改

    mysql>select host, user from user;

    //推送设置到内存

    mysql>FLUSH PRIVILEGES

    2.

    GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

    如果是固定ip就这么写

    grant all privileges on *.* to 'root'@'192.168.0.49'identified by '123' with grant option;

    //推送设置到内存

    mysql>FLUSH PRIVILEGES

    相关文章

      网友评论

          本文标题:mysql开启远程访问权限

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