How Can I find my database host name? - php

Im realy new into this php and android online database thing,So I really ask to somebody to fix my problem.
Im using mysqli_connection and I need my host name for this query ;
$con = mysqli_connect($host,$user,$password,$db);
But the problem is I dont know what is my host my phpMyAdmin site look like this
https://hike.veridyen.com:2083/
and I'm entering my site from this url;
http://dobo.us/atakan/
so what is my host name please ?

If you are using a shared hosting it should be located as follow:
After creating your database, you can find its details, including its
hostname, in your control panel.
Log in to your GoDaddy account.
Click Web Hosting.
Next to the hosting account you want to use, click Manage.
In the Databases area, click MySQL or MSSQL depending on the database type for which you want the host name.
From your list of databases, click Actions next to the database you want to use, and then click Details.
Your database's details displays including its username, host name,
and a link to reset its password.
Instructions above are for GoDaddy, but should give you a general sense of direction.

For SiteGround, use 'localhost'

Related

mySQL Database. Own Website finds it, external programs not?

so I'm creating a website right now where I have a mySQL Database included and I'm displaying some tables of it on my website (with PHP) and it works fine.
But now I'm trying to access the database in another program (Unity) to edit my database.I get the error that the host name wasn't found. Then I tried to ping the ip (given from my hoster 1&1) via the Windows console, but not found. mySQL Workbench doesn't find it either.
I'm wondering if I have to set the database to public or something like that when I want to access it from another program. My Website can access it, probably because it's hosted on the same account.
But I only got a hostname, username, password and database name. The hostname is something like that: "db123456789.db.1and1.com". My domain is of course not this. Do I have to change the host name? On my php website script I used this host name and it works fine.
I'm kind of confused how this works and I can't find any option where I could say like "Hey DB, show yourself to the public".
Any tips? Searched the World Wide Web, but didn't found a hint. Thank you.

Problems connecting to a remote server and performing a simple db query

I have set up a website with basic HTML/CSS files and would like to take that one step further and implement a database with some PHP to perform simple queries and whatnot.
My problem arose when I noticed while setting up the database and creating the PHP files that connect to the database (on my local machine), I used 'localhost' as an argument for mysql_connect. When I then went to drag and drop my newly created HTML/PHP files along with my database into FileZilla to upload the pages onto my remote server, there was a problem connecting to the database. I have a feeling that it is unhappy with the whole 'localhost' notion - yet I don't know what to change it to.
Currently, I am using this line of PHP code to connect to my remote database (which is all located in FileZilla-land).
$link = mysql_connect('localhost','Tommy','pass')
Also, as another quick question: does my remote server have its own phpMyAdmin page? And if so... how would one go about finding it? =D
I appreciate anyone who is able to assist me in my endeavors.
Thank you!!
Log on to your database server, check the details and obtain the correct server information such as server, username and password.
Once you change the server details you shoudl be ready to rock n roll. Edit post with the host name/server name and we may be able to find it for you.
You'll have a phpMyAdmin page where you're hosting the site. Check the membership area or cPanel.
You are right in that 'localhost' in mysql_connect needs to be different. 'localhost' is a textual representation of a loopback address AFAIK - it connects to the computer it is hosted on. As you have uploaded it to your server (a different computer) it is now trying to connect to a mysql server on the server host, instead of your home computer (which holds all the data).
To make this work you'd need to get your database onto the server you are now working from, OR depending on your home setup, point it to your local database.
Whether your host has MySQL/PHPMyAdmin available to you is another matter altogether. If they have MySQL it is probable but not definite that they have a phpmyadmin interface.
Contacting the server host will yield more information. If they have MySQL, it is probably as simple as getting the required details from them, and 'backing up' your SQL on your local server and uploading it to the new server (easily done with PHPMyAdmin)
TL;DR: The database you are trying to connect to doesn't exist on the server you're connecting from.

Can't connect to mysql server

I'm creating a php page (on a godaddy server) which needs to connect to a mysql server and retrieve data from a database. When i run the page i got an error message stating that.
Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on **
It says that the error is on the below line,
$conn=mysql_connect($dbhost,$username,$password);
My doubt is,
What needs to be given in place of username and password? Right now i've given the username and password used while creating a new database inside mysql. What am i doing wrong?
Thanks in advance...
Do not use "localhost" as the hostname for your database-driven websites. Once you have successfully created a database, your host name displays on the Database Information page of your hosting Control Panel.
To Find the Host Name for Your Database
Log in to your Account Manager.
Click Web Hosting.
Next to the hosting account you want to use, click Launch.
In the Databases section of the hosting Control Panel, click MySQL or MSSQL depending on the database type for which you want the host name.
From your list of databases, click Actions next to the database you want to use, and then click Details.
Your database host name displays in the Hostname field.
On shared go daddy DB's you can't use localhost for the $dbhost
you will need to use the location specified in your godaddy mysql cp

how to access database from one website to another website

Hi I'm having problem with accessing database from one of my site to another..
I have one site say a.com and I want to replicate the database from this site to my another site say b.com...
I'm using Cpanel in both the sites. In site A.com, I have created a user with required privileges and also added the other website (b.com) in the access hosts..
Now to access a.com database from b.com, I can use the username and password I have created on a.com but I'm not sure what hostname should I use..
Website a.com use localhost as the hostname..what should I use with b.com..
if you can't connect to the database then it's better to develop some kind of api. Try this
search api to use in external websites you might get some help.
Assuming:
the database is configured to be exposed on the network (if it is designed to be used only from the same machine it shouldn't be, UNIX sockets are preferred)
there is no firewall in the way
the database permissions table grants rights to users on the other server
… then it would be the ip address of the machine the database server is running on.
You should use a.com, or a decent IP address/domain name that will correctly direct the connection to the database.
However, do note you will need to configure the incoming server to accept the connection (i.e. port forwarding, firewall etc).
we can get data from another site by using $.getJSON function of jQuery
You can get detail information from
http://api.jquery.com/jQuery.getJSON sites....

MySql Insert doesn't work when the website deployed on the host!

I'm using XAPP under windows and my website just working well!
when I deployed it on the host server, it seems to be working normally, but the insert requests to MySql doesn't have any effect, nothing is changing on the database!
Does anyone had this issue before? is there any configuration in MySql to make it accept insert requests? or simply whats the best way to make it work!
[EDIT]
I use PhpMyAdmin, I have two tables members and notifications, I wanna configure permissions so I can Insert into the notifications table, any hint please?
thank you
check the permissions on the database server for the username and password that you are using. It can also be restricted by IP address, among others.
Indeed, the administrator can set read-only privileges for a user or for a specific table.
Check out the "grant" command for more information.
it would be helpful if you could find out the error message that MySQL is returning. check your web server log files. if you are using some shared hosting plan, there should be an option in your host control panel to see the web server log files. PHP is configured in most places so that error messages are stored in web server log files. find out what is actually happening there. it could be permissions most likely.

Categories