about mysql database hostname

Status
Not open for further replies.

smoughx1

New Member
Messages
3
Reaction score
0
Points
0
i know right away someone will answer "localhost" and "please read FAQ before posting a question" but please hear me out ok?im currently developing a website that will hold the database, im going to develop an android application where in this application will fetch the data into the website. at first, there is no problem as long as the site itself fetch the data in sql as mysql_connect(Localhost, user, pass); (yes im using php) but here's the problem, i want my mobile application to fetch, display, and post data into the site using mysql database. i cant use "localhost" here, i already tried the given IP address, the hostname given in phpmyadmin "vox.x10hosting.com" and with a port (in my case, 2083) but still cant connect. already tried the "remote host", i have no idea what to do with it, i just give my own IP address but still not working.my concern here is, beside localhost, how can i connect to my database? should do i need a vps?

EDIT:
okay, this answered my question: http://x10hosting.com/wiki/MySQL_Information
second question is, if "Free hosting accounts do not have remote MySQL access." so if i get the premium, i can do the things i mentioned above, right?
 
Last edited:

hbazer

Member
Messages
398
Reaction score
7
Points
18
x10hosting free hosting accounts do not have remote MySQL access
 

smoughx1

New Member
Messages
3
Reaction score
0
Points
0
yes thank you for the fast reply hbazer
but my second concern is that, if i go to x10premium, can i access my msql database remotely?
i would appreciate your answer regarding this, thank you
 

hbazer

Member
Messages
398
Reaction score
7
Points
18
but my second concern is that, if i go to x10premium, can i access my msql database remotely?

Yes

You will need to add the IP for the remote user in cPanel under "remote MySQL"

Host name = (use the server IP address)
Database name = (cPanelUsername_databaseName)
Database username = (cPanelUsername_databaseUsername)
Database password = (the password you entered for that database user)
MySQL Connection Port = 3306
 
Last edited:

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
Please note that this doesn't scale. At all. You (and a small handful of your nearest and dearest) can have remote MySQL access, but you can't give it to "the world". If you intend your app to be for more than your own personal use, direct connection to a remote database is the wrong way to go. You would be much better off creating a stable API using something like JSON as a carrier and housed at a domain you own and control. That will not only allow you to allow wider access and control authentication and permissions¹ separately, it also removes dependencies that don't have to be there, things that depend not only on your host, but on the stack you're using as well. When you use an API (which, in the Free Hosting case, would be a PHP page) you can change everything except the "user surface" of the API on zero notice without affecting your app at all. Migrate to another host? No problem. Switch to a thousand-instance AWS environment with a different database back end? Pshaw, take it off your mind... it's handled. As long as the API can be found at your URL and gives the same responses to the same requests, nothing else matters.
____________________
¹ Fine-grained permissions (row and column-level) are much easier to do in an API than with direct database access since the "meat space" user will have essentially NO permissions on the database. Of course, that's not quite true if you use mysql_connect, etc., since you are wide-open to SQL injection attacks in ways that can't be completely controlled or guarded against. Use PDO instead, or at least the mysqli_ methods, and always used prepared statements.
 

smoughx1

New Member
Messages
3
Reaction score
0
Points
0
thank you for response essellar

i've searching the net after reading your post, i see that i dont need to remote mysql db. With PHP and API, they can communicate using REST with JSON and XML. im very thankful to your answer. thank you very much
 
Status
Not open for further replies.
Top