Results 1 to 5 of 5

Thread: Connecting to remote MySQL

  1. #1
    Join Date
    Nov 2009
    Posts
    153

    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. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Connecting to remote MySQL

    Quote Originally Posted by Gavisht View Post
    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.
    In this case you first connect to local mysql server and then run it

    Quote Originally Posted by Gavisht View Post
    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?
    For now you wants to connect to remote server located on computer 2. Is it you who has designed the application? Your application uses native connection or not? And also check if your mysql server computer 2 permits remote connections.

  3. #3
    Join Date
    Nov 2009
    Posts
    153

    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. #4
    Join Date
    Nov 2008
    Posts
    1,192

    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
    and you will change the config in your wamp on editing log

    You will seek 127.0.0.1 or localhost and you will replace it with 192.168.1.1

  5. #5
    Join Date
    May 2008
    Posts
    2,012

    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

Similar Threads

  1. Connecting C# with MySQL database
    By Quattro in forum Software Development
    Replies: 5
    Last Post: 05-03-2010, 10:13 PM
  2. Issues in C# application connecting to Remote MySQL 5 database.
    By kyosang in forum Software Development
    Replies: 5
    Last Post: 25-01-2010, 04:24 PM
  3. Replies: 3
    Last Post: 07-11-2009, 09:36 PM
  4. Problem connecting to mysql db
    By Wagan-rave in forum Software Development
    Replies: 3
    Last Post: 21-03-2009, 10:57 AM
  5. Connecting VB.net with mysql
    By Jateen in forum Software Development
    Replies: 1
    Last Post: 05-01-2009, 09:37 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,105,150.43350 seconds with 17 queries