zoukankan      html  css  js  c++  java
  • MySQL数据库远程连接开启方法

    有时候需要远程连接mysql数据库,默认是不可以的,可以参考下面的方法,解决下。

    1、登陆自己机器的MySQL数据库:mysql -uroot -p密码 

    设置root用户可以任意IP访问,代码如下(可选,这里%代表任意,也可以指定IP):

    MySQL>update user set host = '%' where user = 'root'; 
    MySQL>select host, user from user; 


    2、MySQL>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

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

    3、MySQL>FLUSH PRIVILEGES;

    修改生效 

    4、MySQL>EXIT 

    退出MySQL服务器 

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

    在其他机器上输入IP和端口(端口默认3306),亲测OK

    C:UsersXXXXX>mysql -uroot -proot -h192.168.0.3 -P3307
    Welcome to the MySQL monitor. Commands end with ; or g.
    Your MySQL connection id is 936
    Server version: 5.5.28 MySQL Community Server (GPL)

    Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

    mysql>

  • 相关阅读:
    获取bootstrap table数据并封装 为json
    不自动切换eclipse视图
    over 分析函数之 lag() lead()
    oracle日期的处理
    表空间的创建
    分析函数 over用法 之row_number() runk_number
    oracle 序列
    Laravel 5
    使用hexo+github搭建免费个人博客详细教程
    windows7设置定时任务运行ThinkPHP框架程序
  • 原文地址:https://www.cnblogs.com/huige-you/p/4280979.html
Copyright © 2011-2022 走看看