6 Replies - 538 Views - Last Post: 07 December 2016 - 01:51 PM

#1 gooby31  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 18
  • Joined: 07-December 16

How do I create a mysql server with a ip instead of localhost?

Posted 07 December 2016 - 12:09 PM

I just setup my first database with MySQL and connected it through Visual Studio.
When I setup the Database on Visual Studio I get prompted with a window called "Add Connection"

and the fields are
Data Source
Server name:
User name:
Password:
[] Save my password
Database name [Dropdown list]

And when i connect my MySQL Database I fill it out like this..

Data Source
Server name: localhost
User name: root
Password: password
[] Save my password
Database name [name of the database]

And if I debug the software and send it to a friend and he tried to open it.. he cant because the server is set on the localhost and he doesnt have the server on his computer.

How do I change it to where I can connect to the database through a IP.. lets say I want to use my IP as a server connection.. Where would I change that?

I'm assuming it would be in MySQL > Manage Server Connections > New and then ass the ip as the host name..

But what IP do I add and do I need to portforward?
Do I add my IPV4 or the one I see at http://cmyip.org

Is This A Good Question/Topic? 0
  • +

Replies To: How do I create a mysql server with a ip instead of localhost?

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13491
  • View blog
  • Posts: 53,888
  • Joined: 12-June 08

Re: How do I create a mysql server with a ip instead of localhost?

Posted 07 December 2016 - 12:33 PM

You would need a server with connections available to the internet.. that may be reworking any routers.. having a separate machine.. etc.. alternatively you can have a database on a hosted website and use a webservice to shuffle data back and forth.
Was This Post Helpful? 0
  • +
  • -

#3 gooby31  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 18
  • Joined: 07-December 16

Re: How do I create a mysql server with a ip instead of localhost?

Posted 07 December 2016 - 01:06 PM

So I could set it up with my machine what I am running on now?
Would i portforward the port and use my ip from cmyip.org?
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13491
  • View blog
  • Posts: 53,888
  • Joined: 12-June 08

Re: How do I create a mysql server with a ip instead of localhost?

Posted 07 December 2016 - 01:18 PM

In theory.. yeah? There's a lot of things that need to undo the ambient security of opening your machine up to the web.. especially for a DB service.
Was This Post Helpful? 0
  • +
  • -

#5 gooby31  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 18
  • Joined: 07-December 16

Re: How do I create a mysql server with a ip instead of localhost?

Posted 07 December 2016 - 01:32 PM

Okay so I was trying to see this from another point of view..

What if I explain it like this..

I need to setup a database in MySQL.
I want to connect to that database via Visual Studio and my application.

Let's say my database in MySQL was configured to the ip localhost
Then ANyone who is NOT on my network wont be able to connect.

How do I make it to where people whoa rent on my network can connect?

I wanted to setup a server on my own IP so people connect through my IP but then I would have to portforward "3306" (I think)

Now.. In "Hostname" https://i.imgur.com/rXkTrtu.png
What do I add?
Was This Post Helpful? 0
  • +
  • -

#6 astonecipher  Icon User is offline

  • Too busy for this
  • member icon

Reputation: 2330
  • View blog
  • Posts: 9,381
  • Joined: 03-December 12

Re: How do I create a mysql server with a ip instead of localhost?

Posted 07 December 2016 - 01:44 PM

That image is to connect to an instance, not to configure an existing one. You would then set your router to forward data to your in network IP (192.168.*.* or some such). For others to connect, mind you this is dangerous, there are IP crawlers that will still hit your system, you would have them connect to you outside IP on that forwarded port.
Was This Post Helpful? 0
  • +
  • -

#7 no2pencil  Icon User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6552
  • View blog
  • Posts: 30,682
  • Joined: 10-May 07

Re: How do I create a mysql server with a ip instead of localhost?

Posted 07 December 2016 - 01:51 PM

Generally you don't make the database publicly accessible. Traffic from the internet hits your application, & your application communicates with your database. Your database should only be allowing traffic from the application server.

View Postastonecipher, on 07 December 2016 - 03:44 PM, said:

For others to connect, mind you this is dangerous, there are IP crawlers that will still hit your system

Additionally, residential internet service may not allow such ports to accept traffic. As well, DHCP will cause your application to become unavailable when the IP address changes.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1