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) 错误的话。

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

  • 相关阅读:
    超市帐单系统
    JavaOOP
    拦截器的工作原理是什么?
    struts2
    500错误
    idea添加struts框架后报错
    2019春第九周作业
    2019春第八周作业
    2019春第七周作业
    2019春第六周作业
  • 原文地址:https://www.cnblogs.com/angryprogrammer/p/3658163.html
Copyright © 2011-2022 走看看