|
|
Php / Mysql Database Connection / Creation Problems | ||
Discussion by mpd12 with 6 Replies.
Last Update: February 23, 2006, 6:59 am | |||
![]() |
|
|
I have been trying to connect to mysql via a simple bread and butter php script but I don't seem to be getting anywhere. The script I'm using is below:
CODE
<?php// set your infomation.
$dbhost='localhost';
$dbusername='MyTrap17Username';
$dbuserpass='MyTrap17Password';
$dbname='MyDatabaseName';
// connect to the mysql database server.
mysql_connect ($dbhost, $dbusername, $dbuserpass);
// create the database.
mysql_query("CREATE DATABASE $dbname");
?>
Basically I'm trying to setup a php forum called pubBB. When I run pubBB's install.php and enter the MySQL data I've entered into the php script I've used; Database server hostname, Database name, Username, Password and click the start install button, I get this error message:
QUOTE
An error occured on line 58 in file MyRoot/include/dblayer/mysql.php.PunBB reported: Unable to connect to MySQL server. MySQL reported: Access denied for user 'MyUsername'@'localhost' (using password: YES)
From what I gather, punBB can't connect to the MySQL database using the details I've provided meaning that my script also dosen't connect to the MySQL database server at localhost. Nor does it let me create my database.
To cut a long story and post short then, how do I go about setting up a MySQL database on my Trap17 account. I feel I may be going about this completely the wrong way.
[note=mayank]Added CODE & Quote tags[/note]
You can view a meaningful error, by changing the mysql_query to use the code below.
CODE
mysql_query("CREATE DATABASE $dbname") or die(mysql_error());
You should receive output from your internet browser informing you why the query was unsuccessful, which will assist you with the debugging.
Edit: Sorry for the incorrect post originally. I misunderstood what it was you were trying to do, but after a little bit of concentration on your post, I worked it out. (I originally thought that you were trying to create a database table instead of a database). I have updated my post to provide additional help from your script itself. Hopefully it'll help
QUOTE
Access denied for user 'myusername'@'localhost' (using password: YES)Basically won't let me connect to the database server (I tried it on just mysql_connect aswell).
What I'm trying to do is create a mysql database on my account with no tables in using php. I don't know what username and password I should use to connect to trap17's database server on localhost so I assumed it was my trap17 username and password.
All I want to know is how would any of you go about setting up a mysql database on your trap 17 account? Can you just import a mysql database from mysql on your desktop? I haven't got mysql installed on my desktop as I was trying to create a mysql database serverside on trap 17 using php.
Here is the results from setting up a database at the trap17 site I am involved with:
MySQL DataBase name: NNNN --> I have changed the number to 'NNNN'
MySQL DataBase login username: NNNN --> ditto
MySQL DataBase login password: The same as for FTP and account manager
MySQL DataBase hostname: localhost
To admin your database please go to: phpMyAdmin using your MySQL username and password.
All sorted now!!!
All those settings were in the confirmation email I was sent too, didn't bother to read it!
Similar Topics:
Php And Mysql Programming
Best Php And Mysql Editor For Noobs
remote server connection JSP and ...
File .class (3)
|
(1) Help ! Trouble Installing A Blog using MySQL database
|
Loading...
HOME 






