zoukankan      html  css  js  c++  java
  • MYSQL不能从远程连接的解决方法

    为了在其它电脑上能用root用户登录,需进行以下动作:

    首先在mysql服务器端打开mysql

    1、 mark>mysql -u root -p

    //输入密码,进入MySQL服务器

    2、mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password'; (注意要带单引号)

    //赋予任何主机访问数据的权限

    3、mysql>FLUSH PRIVILEGES

    //修改生效

    4、mysql>EXIT

    //退出MySQL服务器

    这样就可以在其它任何的主机上以root身份登录啦!

    客户端(windows)

    c:program filesmysqlmysql server 5.1in>mysql -h 192.168.0.249 -uroot -p

    enter password:

    远程报错:

    ERROR 2003(HY000):Can't connect to MySQL server on '192.168.0.249' (10065)

    把linux服务器的防火墙添加端口tcp: 3306后就OK了。

    c:program filesmysqlmysql server 5.1in>mysql -h 192.168.0.249 -uroot -p

    enter password:

    Welcome to the MySQL monitor. Commands end with ; or g.

    Your MySQL connection id is 13

    Server version:4.1.22-standard-log

    Type 'help' or 'h' for help. Type 'c' to clear the buffer.

    mysql>

    如果出现: 1045 Access denied for user 'root'@'192.168.1.3' (using password:YES) 错误的话。

    是因为上述第二步密码为'%' 所以不用加密码即可。

  • 相关阅读:
    Css_加载样式
    Mvc4_@RenderBody()和@RenderSection()
    C#_观察者模式
    Mvc4_MvcPager 概述
    Mvc4_Area的应用
    Nginx 服务器性能参数设置
    Nginx变量的实现机制
    天下无雾
    Nginx Http框架的理解
    【转】websocket协议规范
  • 原文地址:https://www.cnblogs.com/angryprogrammer/p/3658163.html
Copyright © 2011-2022 走看看