当前位置:网站首页>Two methods for MySQL to open remote connection permission
Two methods for MySQL to open remote connection permission
2022-06-30 16:14:00 【1024 Q】
An evaluation system is required , Because I have been done a small part before , There's a database out there ( database :MySQL 5.7 , Database software :MySQL workbench 6.3 CE), In order to save the trouble of installing database export and import tables , You want to connect to the other party's database directly and remotely .
The method is as follows :First , Check whether the firewall of the server to connect to the database is closed , Check whether the connection with the server is smooth ( Method : stay cmd Console Input ping ip Address )
Secondly, there are two ways to search through the Internet :1, Modified table method .Maybe your account doesn't allow remote login , Only in localhost. At this time, as long as localhost The computer of , Log in mysql after , change "mysql" In the database "user" Exterior and interior "host" term , from "localhost" rename "%"
mysql -u root -pvmwaremysql>use mysql; mysql>update user set host = '%' where user = 'root'; mysql>select host, user from user;2, The law of authorization . In the installation mysql Running on the machine :
1、d:\mysql\bin\>mysql -h localhost -u root
// This should allow access to MySQL The server
2、mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION
// Give any host access to data
3、mysql>FLUSH PRIVILEGES
// The amendment takes effect
4、mysql>EXIT
// sign out MySQL The server
This allows you to run on any other host with root I'm logged in .
You can't test either method by yourself , It's strange , So I tested myself :
find MySQL File location of , stay cmd Input in cd mysql.exe File location of ( Generally in MySQL Installation directory bin Under the document )
Input mysql -u root -p Enter the login password to login MySQL

stay MySQL Input directly in GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION , It will appear as follows

This is because there is no semicolon in English .
Try typing a statement with a semicolon :

Prompt no rows found .
I decided to use the first method first , The code according to the first method , Input :
mysql -u root -p // This is login. mysql>use mysql; // mysql>update user set host = '%' where user = 'root'; // mysql>select host, user from user; //The results are shown in the following figure

Connect remote MySQL, Still not connected , So try the second way
Input :
d:\mysql\bin\>mysql -h localhost -u root mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION; mysql>FLUSH PRIVILEGES; mysql>EXIT;Be sure to end here with a semicolon !!!
The results are shown in the following figure

At this time, there is no above ERROR 1133 Wrong. , After testing , You can already connect to the remote server .
The general implementation steps are as follows :
Reference article :
http://www.cnblogs.com/ycsfwhh/archive/2012/08/07/2626597.html
http://zhidao.baidu.com/link?url=knBlHE7vm912Lr_1c1OKlL_OYoyuuYQrRo4zLHbBYytBsjAP1VRCJFtZAOkBMMzDm_2kk69UlrE4RDdMwUO6X6SfFjRYKoUTMYnVPZrIvvm
summaryThis is about MySQL This is the end of the article on the two methods of opening remote connection permissions , More about MySQL For the content of open remote connection permission, please search the previous articles of the software development network or continue to browse the following related articles. I hope you can support the software development network in the future !
边栏推荐
- Under the pressure of technology, you can quickly get started with eth smart contract development, which will take you into the ETH world
- Implementation of Devops in the core field of qunar, the Internet R & D Efficiency
- [cve-2019-0193] - Apache Solr dataimport remote command execution analysis
- Does flinkcdc have to be a clustered version if the monitored database is Mongo
- How cloudxr promotes the future development of XR
- Finally understand science! 200 pictures to appreciate the peak of human wisdom
- Log4j2 advanced use
- ASP. Net core signalr tutorial
- [leetcode] linked list sorting (gradually increasing the space-time complexity)
- 【算法篇】四种链表总结完毕,顺手刷了两道面试题
猜你喜欢

【Unity UGUI】ScrollRect 动态缩放格子大小,自动定位到中间的格子

ASP. Net core signalr series hub tutorial

边缘计算平台如何助力物联网发展
![[time series database incluxdb] code example for configuring incluxdb+ data visualization and simple operation with C under Windows Environment](/img/50/4b7aa2273a64ed531d13ecdbeed6a6.png)
[time series database incluxdb] code example for configuring incluxdb+ data visualization and simple operation with C under Windows Environment
![Warning: [antd: Menu] `children` will be removed in next major version. Please use `items` instead.](/img/c1/99ad29789a669c4498fb93ce1fb009.png)
Warning: [antd: Menu] `children` will be removed in next major version. Please use `items` instead.

Policy Center > Malware > Malware

Simulate user login function

技不压身,快速入门ETH智能合约开发,带你进入ETH世界

CVPR 2022丨特斯联AI提出:基于图采样深度度量学习的可泛化行人重识别

Policy Center > Misrepresentation
随机推荐
Model system: Sword (1)
Simulate user login function
Oculus quest2 | unity configures the oculus quest2 development environment and packages an application for real machine testing
How cloudxr promotes the future development of XR
'<', Hexadecimal value 0x3c, is an invalid problem solving
[time series database incluxdb] code example for configuring incluxdb+ data visualization and simple operation with C under Windows Environment
'<', hexadecimal value 0x3C, is an invalid 问题解决
[CVE-2019-0193] - Apache Solr DataImport 远程命令执行分析
With as subquery in Oracle
topic: Privacy, Deception and Device Abuse
Swagger's asp Net core web API help page
BYD is more and more like Huawei?
360 digital, ant group, etc. were selected as member units of the "business security promotion plan" of the Chinese Academy of Communications
Container common commands
flink sql cdc 同步sqlserver 报错什么原因啊
Policy Center > Malware > Malware
几百行代码实现一个 JSON 解析器
Google Play 索引表
from Crypto. Cipher import AES could not find the solution record with module error
Google play index table