当前位置:网站首页>Solve the problem of remote connection to MySQL under Linux in Windows
Solve the problem of remote connection to MySQL under Linux in Windows
2022-07-06 10:10:00 【Eric-x】
Preface
In actual development , We must connect to the database remotely , How is this set , Let's explore .
List of articles
Preparation conditions : One has MySQL Virtual machine of database , One has MySQL Database window
1、 problem
In use SQLyog or Navicat Configure remote connections in Mysql The following error messages are encountered when the database , This is because Mysql Configured... Caused by unsupported remote connection .
2、 Confirm the network
stay window Upper use ping ip Address Make sure the network is smooth
for example :ping 192.168.1.150
Turn on window Medium Telnet client
Open the control panel , Select small icon display , Click programs and functions , Then click enable or close window function
take Telnet Client check
3、 Turn off firewall or open port
Want to connect Linux Under the MySQL, You need to turn off the firewall or open the port , Choose one of them
The way 1: Turn off firewall
CentOS6 Instructions :service iptables stop
CentOS7 Appoint :systemctl stop firewalld.service
Set boot disable firewall :systemctl disable firewalld.service
The way 2: Open ports
// Check the open port number
firewall-cmd --list-all
// Set the open port number
firewall-cmd --add-service=http --permanent
firewall-cmd --add-port=3306/tcp --permanent
// service iptables restart
firewall-cmd --reload
4、 modify Linux Configuration below
1、 Turn on the virtual machine , Connect Linux Under the MySQL, Use as follows sql
use mysql;
select Host,User from user;
You can see root The current host configuration information of the user is localhost. It means using root Users can only connect to the database locally
modify Host For wildcard %
Host Column specifies the IP, such as user=root Host=192.168.1.1. This means that root Users can only pass through 192.168.1.1 Client access . user=root Host=localhost, It means that it can only be accessed through the local client . and % It's a wildcard , If Host=192.168.1.%, So that means as long as it's IP Address prefix is “192.168.1.” All clients of can connect . If Host=% , Express all IP All have connection permission .
Be careful : In a production environment, you can't save host Set to %, There will be security problems , Specific settings can be set according to the production environment IP Set it up
update user set host = '%' where user ='root';
Host Set up “%” Then you can allow remote access .
Host Remember to execute after modification flush privileges Make the configuration take effect immediately :
flush privileges;
5、 test
- If it is MySQL5.7 edition , You can use SQLyog perhaps Navicat Successfully connected to MySQL 了 .
- If it is MySQL8 edition , The following problems also occur when connecting :
Configuration new connection error : Wrong number 2058, The analysis is mysql Password encryption has changed
resolvent :Linux Next mysql -u root -p Log in to your mysql database , then Implement this SQL:
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'abc123';
And then reconfigure SQLyog The connection of , The connection is successful , Fix up the work .
summary
In fact, the process is still very simple :
- First, check whether this machine can ping Through virtual machines IP Address
- Turn on window Medium Telnet Client services
- close Linux The firewall of ( Or open 3306 port )
- modify Linux Next MySQL Remote connection configuration ( Remember to refresh it immediately )
- Finally, if it is MySQL8.0 Reuse as above SQL Set up MySQL You can succeed ~
边栏推荐
- Control the operation of the test module through the panel in canoe (primary)
- jar运行报错no main manifest attribute
- CAPL 脚本对.ini 配置文件的高阶操作
- NLP路线和资源
- 寶塔的安裝和flask項目部署
- Which is the better prospect for mechanical engineer or Electrical Engineer?
- CAPL 脚本打印函数 write ,writeEx ,writeLineEx ,writeToLog ,writeToLogEx ,writeDbgLevel 你真的分的清楚什么情况下用哪个吗?
- CDC: the outbreak of Listeria monocytogenes in the United States is related to ice cream products
- Carolyn Rosé博士的社交互通演讲记录
- MySQL实战优化高手04 借着更新语句在InnoDB存储引擎中的执行流程,聊聊binlog是什么?
猜你喜欢
MySQL combat optimization expert 12 what does the memory data structure buffer pool look like?
CAPL script pair High level operation of INI configuration file
Listen to my advice and learn according to this embedded curriculum content and curriculum system
AI的路线和资源
Notes of Dr. Carolyn ROS é's social networking speech
MySQL Real Time Optimization Master 04 discute de ce qu'est binlog en mettant à jour le processus d'exécution des déclarations dans le moteur de stockage InnoDB.
Control the operation of the test module through the panel in canoe (primary)
The programming ranking list came out in February. Is the result as you expected?
51单片机进修的一些感悟
西南大学:胡航-关于学习行为和学习效果分析
随机推荐
oracle sys_ Context() function
MySQL combat optimization expert 07 production experience: how to conduct 360 degree dead angle pressure test on the database in the production environment?
在CANoe中通过Panel面板控制Test Module 运行(高级)
好博客好资料记录链接
MySQL实战优化高手12 Buffer Pool这个内存数据结构到底长个什么样子?
Automation sequences of canoe simulation functions
寶塔的安裝和flask項目部署
Installation of pagoda and deployment of flask project
MySQL combat optimization expert 04 uses the execution process of update statements in the InnoDB storage engine to talk about what binlog is?
Preliminary introduction to C miscellaneous lecture document
MySQL Real Time Optimization Master 04 discute de ce qu'est binlog en mettant à jour le processus d'exécution des déclarations dans le moteur de stockage InnoDB.
Contrôle de l'exécution du module d'essai par panneau dans Canoe (primaire)
The 32-year-old fitness coach turned to a programmer and got an offer of 760000 a year. The experience of this older coder caused heated discussion
MySQL实战优化高手04 借着更新语句在InnoDB存储引擎中的执行流程,聊聊binlog是什么?
14 medical registration system_ [Alibaba cloud OSS, user authentication and patient]
竞赛vscode配置指南
16 医疗挂号系统_【预约下单】
Notes of Dr. Carolyn ROS é's social networking speech
CANoe的数据回放(Replay Block),还是要结合CAPL脚本才能说的明白
South China Technology stack cnn+bilstm+attention