mysql如何开启远程连接

链接地址:http://jingyan.baidu.com/article/046a7b3ed85f3ef9c27fa9dc.html

大家在公司工作中,经常会遇到mysql数据库存储于某个人的电脑上,大家要想连接mysql服务,装有mysql服务的电脑就必须开启远程连接。

工具/原料

  • mysql
  • windows

方法/步骤

  1.  

    使用“Ctrl + R”组合键快速打开cmd窗口,并输入“cmd”命令,打开cmd窗口。

    mysql如何开启远程连接
  2.  

    使用“mysql -uroot -proot”命令可以连接到本地的mysql服务。

    mysql如何开启远程连接
  3.  

    使用“use mysql”命令,选择要使用的数据库,修改远程连接的基本信息,保存在mysql数据库中,因此使用mysql数据库。

    mysql如何开启远程连接
  4.  

    使用“GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;”命令可以更改远程连接的设置。

    mysql如何开启远程连接
  5.  

    使用“flush privileges;”命令刷新刚才修改的权限,使其生效。

    mysql如何开启远程连接
  6.  

    使用“select host,user from user;”查看修改是否成功。

     
     
    mysql如何开启远程连接
     

  7. Microsoft Windows [版本 6.1.7601]
    版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

    C:\Users\Administrator>D:

    D:\>cd mysql_5.6.24_winx6420151123

    D:\mysql_5.6.24_winx6420151123>cd mysql-5.6.24-winx64

    D:\mysql_5.6.24_winx6420151123\mysql-5.6.24-winx64>cd bin

    D:\mysql_5.6.24_winx6420151123\mysql-5.6.24-winx64\bin>dir
    驱动器 D 中的卷是 SoftWare
    卷的序列号是 0001-F4BC

    D:\mysql_5.6.24_winx6420151123\mysql-5.6.24-winx64\bin 的目录

    2015-11-23 17:11 <DIR> .
    2015-11-23 17:11 <DIR> ..
    2015-03-25 18:06 134,656 echo.exe
    2015-03-25 18:06 936,960 echo.pdb
    2015-03-25 18:07 4,064,256 innochecksum.exe
    2015-03-25 18:07 3,075,072 innochecksum.pdb
    2015-03-25 18:09 4,519,424 myisamchk.exe
    2015-03-25 18:09 4,180,992 myisamchk.pdb
    2015-03-25 18:09 4,302,336 myisamlog.exe
    2015-03-25 18:09 3,640,320 myisamlog.pdb
    2015-03-25 18:09 4,427,776 myisampack.exe
    2015-03-25 18:09 4,041,728 myisampack.pdb
    2015-03-25 18:09 4,395,520 myisam_ftdump.exe
    2015-03-25 18:09 3,951,616 myisam_ftdump.pdb
    2015-03-25 18:09 4,859,392 mysql.exe
    2015-03-25 18:09 5,819,392 mysql.pdb
    2015-03-25 18:09 4,748,288 mysqladmin.exe
    2015-03-25 18:09 5,598,208 mysqladmin.pdb
    2015-03-25 18:09 4,917,248 mysqlbinlog.exe
    2015-03-25 18:09 6,188,032 mysqlbinlog.pdb
    2015-03-25 18:09 4,742,144 mysqlcheck.exe
    2015-03-25 18:09 5,557,248 mysqlcheck.pdb
    2015-03-25 18:05 33,272,320 mysqld-debug.exe
    2015-03-25 18:05 35,539,968 mysqld-debug.pdb
    2015-03-25 18:11 13,052,928 mysqld.exe
    2015-03-25 18:11 33,795,072 mysqld.pdb
    2015-03-25 18:09 4,816,384 mysqldump.exe
    2015-03-25 18:09 5,712,896 mysqldump.pdb
    2015-03-25 18:02 7,635 mysqldumpslow.pl
    2015-03-25 18:02 27,732 mysqld_multi.pl
    2015-03-25 18:02 36,098 mysqlhotcopy.pl
    2015-03-25 18:08 4,736,000 mysqlimport.exe
    2015-03-25 18:08 5,565,440 mysqlimport.pdb
    2015-03-25 18:08 4,736,000 mysqlshow.exe
    2015-03-25 18:08 5,540,864 mysqlshow.pdb
    2015-03-25 18:08 4,762,112 mysqlslap.exe
    2015-03-25 18:08 5,663,744 mysqlslap.pdb
    2015-03-25 18:08 5,042,688 mysqltest.exe
    2015-03-25 18:08 6,302,720 mysqltest.pdb
    2015-03-25 18:11 14,016,000 mysqltest_embedded.exe
    2015-03-25 18:11 31,632,384 mysqltest_embedded.pdb
    2015-03-25 18:09 5,234,688 mysql_client_test.exe
    2015-03-25 18:11 14,265,344 mysql_client_test_embedded.exe
    2015-03-25 18:11 31,607,808 mysql_client_test_embedded.pdb
    2015-03-25 18:02 9,079 mysql_config.pl
    2015-03-25 18:09 4,534,272 mysql_config_editor.exe
    2015-03-25 18:09 4,983,808 mysql_config_editor.pdb
    2015-03-25 18:02 4,504 mysql_convert_table_format.pl
    2015-03-25 18:11 13,870,080 mysql_embedded.exe
    2015-03-25 18:11 31,304,704 mysql_embedded.pdb
    2015-03-25 18:09 4,074,496 mysql_plugin.exe
    2015-03-25 18:09 3,091,456 mysql_plugin.pdb
    2015-03-25 18:02 10,518 mysql_secure_installation.pl
    2015-03-25 18:07 3,951,104 mysql_tzinfo_to_sql.exe
    2015-03-25 18:07 2,690,048 mysql_tzinfo_to_sql.pdb
    2015-03-25 18:09 4,224,000 mysql_upgrade.exe
    2015-03-25 18:09 3,189,760 mysql_upgrade.pdb
    2015-03-25 18:07 4,055,552 my_print_defaults.exe
    2015-03-25 18:07 2,993,152 my_print_defaults.pdb
    2015-03-25 18:08 4,189,696 perror.exe
    2015-03-25 18:08 3,189,760 perror.pdb
    2015-03-25 18:07 3,966,464 replace.exe
    2015-03-25 18:07 2,747,392 replace.pdb
    2015-03-25 18:07 4,054,016 resolveip.exe
    2015-03-25 18:07 2,993,152 resolveip.pdb
    63 个文件 453,594,446 字节
    2 个目录 10,312,916,992 可用字节

    D:\mysql_5.6.24_winx6420151123\mysql-5.6.24-winx64\bin>mysql -u root -p
    Enter password: ***
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 90
    Server version: 5.6.24 MySQL Community Server (GPL)

    Copyright (c) 2000, 2015, 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> use mysql
    Database changed
    mysql> select host,user from user;
    +-----------+------------+
    | host | user |
    +-----------+------------+
    | % | nixinsheng |
    | % | root |
    | 127.0.0.1 | root |
    | ::1 | root |
    | localhost | |
    | localhost | nixinsheng |
    | localhost | root |
    +-----------+------------+
    7 rows in set (0.00 sec)

    mysql> use test
    Database changed
    mysql> select * from stuinfo
    -> ;
    +------------+--------+-----+---------+------+
    | id | name | sex | lesson | mark |
    +------------+--------+-----+---------+------+
    | 0000000001 | 倪新生 | 男 | Englist | 学生 |
    | 0000000002 | 倪新伟 | 男 | Chiness | 学生 |
    | 0000000003 | 韩露 | 女 | Math | 学生 |
    | 0000000004 | 冯孜珂 | 女 | PE | 学生 |
    +------------+--------+-----+---------+------+
    4 rows in set (0.00 sec)

    mysql>

  8. mysql如何开启远程连接mysql如何开启远程连接mysql如何开启远程连接
上一篇:Linux Mysql 安装 开启远程连接 供python agent 连接测试 Mark


下一篇:斯坦福新深度学习系统 NoScope:视频对象检测快1000倍