http://dev.mysql.com/downloads/mysql/ 下载地址 , 在下拉框中选择相应的版本
windows 下直接双击下载文件安装
直接上图吧
本地连接测试一下 .
E:\mysql\bin>mysql -h 172.16.20.31 -u root -p
Enter password: *****
ERROR 1130 (HY000): Host '192.168.111.112' is not allowed to connect to this MySQL server
在 server 短执行如下动作:
Enter password: *****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.7.14-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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 user,host from user;
+-----------+-----------+
| user | host |
+-----------+-----------+
| mysql.sys | localhost |
| root | localhost |
+-----------+-----------+
2 rows in set (0.00 sec)
root 用户只允许在 127.0.0.1 和 localhost 上进行连接,而不允许使用本机在局域网中的 ip 进行连接
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.111.112' IDENTIFIED BY 'mysql' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)
mysql>
重新连接生效 ,
E:\mysql\bin>mysql -h 172.16.20.31 -u root -pmysql
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.7.14-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sakila |
| sys |
| world |
+--------------------+
6 rows in set (0.01 sec)
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24237320/viewspace-2124675/ ,如需转载,请注明出处,否则将追究法律责任。