|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Connecting to remote MySQL My problem is that I'm unable to connect to a database located in a local computer of company, that computer use wamp server (latest version). Computer 1 has an application in vb.net and its IP address is: 192.168.1.3 and tries to connect to computer 2, which contains the database named "db1", its IP configuration is: 192.168.1.1 In my program I have in a first form, 4 TextBox: - Server. - User. - Password. - Database. I installed wamp server on computer 1 and on the Form I typed: Server = localhost User = root Password = Database = db1 Everything goes well, I'm connected, I'm happy. After I uninstalled wamp server on computer 1. And I open my form and I typed: Server = 192.168.1.1 User = root Password = Database = db1 but nothing goes well, I'm not online. I created a new user in the user table in mysql DB (computer 2) I tried connecting but ANYTHING happens. I then put % instead of localhost but NOTHING works this time. I stopped the firewall and everything is configured perfectly but all in vain. Why it does not works? |
#2
| |||
| |||
Re: Connecting to remote MySQL Quote:
Quote:
|
#3
| |||
| |||
Re: Connecting to remote MySQL Thank you for the reply. Yes it is me who has designed the application and I am trying to make other changes above. One of the amendments is to connect to remote mysql. Yes I use a native connection and my computer allows remote connections. I am a little confused about all this stuffs. |
#4
| |||
| |||
Re: Connecting to remote MySQL You will have to change your connection string stringconnection in your program on connection so you use a code for example: Code: try Dim myConnectionString As String myConnectionString = "Server=192.168.1.1;Database=db1; UID=root;Password= " Dim myConnection As New MySqlConnection(myConnectionString) myConnection.Open() Dim myselectquery As String = "SELECT * from `minichat`.`user` WHERE `user`.`login` = '" & cvalid_selected & "';" Dim myCommand As New MySqlCommand(myselectquery, myConnection) Dim myready As MySqlDataReader myready = Nothing myready = myCommand.ExecuteReader() myready.Close() myConnection.Close() Catch ex As Exception End Try You will seek 127.0.0.1 or localhost and you will replace it with 192.168.1.1 |
#5
| |||
| |||
Re: Connecting to remote MySQL I found your problem, you work on a root and the user root and default connects local host. Tthe solution is that you create another user 1 - open PHPMYADMIN (click on the wamp notification icon) 2 - a page opens, its the page created in the database 3 - you will click on the "Privileges" 4 - you can see the root user and these settings and can see that root travel locally 5 - you click on the link "Add User" 6 - to fill the form Username: * you can parametrize your mysql server It accepts the user "Any user" Server: * select "Any Server" to allow the pc to connect that server password: you can keep a password or let it be blank and for the menu "Database for this user" chose "Giving privileges passepartout ("%")" and for "global privileges": check all preferable click and perform ultimately change the username and password on your connection string |
![]() |
|
Tags: connect, mysql, remote connection, vbnet, wamp server |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Connecting C# with MySQL database | Quattro | Software Development | 5 | 05-03-2010 10:13 PM |
Issues in C# application connecting to Remote MySQL 5 database. | kyosang | Software Development | 5 | 25-01-2010 04:24 PM |
Mysql Error : Can't connect to local mysql server through socket ' var lib mysql mysql.sock' 2 | roshan45 | Software Development | 3 | 07-11-2009 09:36 PM |
Problem connecting to mysql db | Wagan-rave | Software Development | 3 | 21-03-2009 10:57 AM |
Connecting VB.net with mysql | Jateen | Software Development | 1 | 05-01-2009 09:37 PM |