Can't connect to MySQL Database

Darie

New Member
Messages
6
Reaction score
0
Points
0
Hello there !

It doesn't matter what i try i cannot connect to the database i created in the cpanel.
I'm trying to connect with a php-script to it, but the connection doesn't establish

here is the script i use:

<?php
mysql_connect("absolut.x10hosting.com", "darie_admin", "****") or die ("ERROR: can't connect to mysql-server");
mysql_select_db("darie_database") or die ("ERROR: can't connect to database");
?>

i created the database with the mysql-center in the cpanel, database's name is shown as "darie_database"
and i added a user called "darie_admin"

Please help ! Thanx
Darie
 
Last edited:

gateway

New Member
Messages
109
Reaction score
0
Points
0
The php script is cool but I don't actually know what you are trying to install. but for many i know, these scripts has alternative config file that requires the information about your database. it seems you put this information in the wrong file. If the original file contains $db or $somenthing similar, then you do not have to replace it by your db user name or db. If no configuration file is available, then check the main file ( INDEX FILE) to see all file inclusions
 

Darie

New Member
Messages
6
Reaction score
0
Points
0
Sorry, i don't understand what you are talking about... There is nothing i want to install.... (by the way isn't
php pre-installed by the provider? Is is possible to config php through the cpanel?)
I just have the script in my public folder and the commands were taken from a php-tutorial site (copy and paste party until i get used to php)
By the way meanwhile i managed to connect with this script by replacing "absolut.x10hosting.com" with
"localhost.x10hosting.com" and replacing the username "darie_admin" with my cpanel-username "darie".
But i don't understand the logic behind using "localhost" instead of the serverhosts name "absolut".
Using "absolut" doesn't work....but shouldn't it work too ?
I also want to connect to the database from my computer to edit its contents with openoffice base.
I use ODBC/MySQL Connector V.5 for it but i can't establish any connection to it !
If there's an admin reading my post please post back. I've read in another posting that admins first have to
open MySQL ports for connects from outside the domain. Please tell me if i am wrong !:cool:

Greetz
Darie
 

FengFeng

New Member
Messages
59
Reaction score
0
Points
0
Is the script localed in the web"absolut.x10hosting.com"??
If the script is localed in it,try this:
<?php
mysql_connect("hostlocal", "darie_admin", "****") or die ("ERROR: can't connect to mysql-server");
mysql_select_db("darie_database") or die ("ERROR: can't connect to database");
?>
 

luni1

New Member
Messages
81
Reaction score
0
Points
0
shouldn't it be localhost instead of hostlocal?

Is the script localed in the web"absolut.x10hosting.com"??
If the script is localed in it,try this:
Quote:
<?php
mysql_connect("hostlocal", "darie_admin", "****") or die ("ERROR: can't connect to mysql-server");
mysql_select_db("darie_database") or die ("ERROR: can't connect to database");
?>

but other then that looks fine...try it and see .....
 
Top