Reputation: 9293
define('DBHOST','localhost');
define('DBUSER','root');
define('DBPASS','');
define('DBNAME','mozaik-matria');
The above is part of çonfig.php
and it works on localhost.
Moving on remote server I cannot find any info (using cpanel and phpMyAdmin) about DBHOST
parameter.
I tried with pure url (http://example.com/
) and subdomain (http://subdomain.example.com/
) - without success:
SQLSTATE[HY000] [2005] Unknown MySQL server host...
Upvotes: 0
Views: 9950
Reputation: 900
To connect the remote database, you have to add the port 3306 for the mysql and don't forget to specify the username and password of the database.
mysql_connect('your_my_sql_servername or IP Address', 'new_user_which_u_created', 'password');
Upvotes: 0
Reputation: 196
The easiest way to find out the hostname for your MySQL database is to go to your cPanel -> phpMyAdmin and it will be listed there for you.
Upvotes: 0
Reputation: 98
idk, is this help ? :
mysql_connect('localhost','root','') or die('Can't Connect To DBase');
mysql_select_db('mozaik-matria');
Upvotes: 0
Reputation: 355
on c panel there will be an option for databases select database and create user credentials and then use localhost as dbhost
if you db is deploy on other host then use that url enter image description here
Upvotes: 1
Reputation: 5322
In most of the server like godaddy. the hostname as localhost are work fine.
But you can use example.com as hostname.
And user name you can find from the database wizard. if username does not exist than you have to create user. And same for the database.
Exa:
define('DBHOST','example.com');
define('DBUSER','username');
Upvotes: 2