简体   繁体   中英

How to connect C# Winform Project to the XAMPP MySQL server in LAN?

I have wrote a simple program which uses MySQL db server of XAMPP. Program works fine when I connect to 'localhost':

在此处输入图像描述

But when I try connect a MySQL db from another computer (in my LAN):

在此处输入图像描述

it gives below error:

在此处输入图像描述

But I can connect to that 'phpmyadmin' from browser:

在此处输入图像描述

(or Can it be that the computers which I'm testing are domain members?)

Actually the problem was, MySQL server settings has set to work only for local connections (by default):

在此处输入图像描述

So, then I uncommented the second line and chanded to:

在此处输入图像描述

And it worked. ' 127.0.0.1 ' means localhost and ' 0.0.0.0 ' means any host

Please check your Firewall on the remote machine. It might block the mysql connection and has an exception rule for HTTP Ports, thats why phpMyAdmin is reachable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM