Loading...


bookmark - Php / Mysql Database Connection / Creation Problems

Php / Mysql Database Connection / Creation Problems

 
 Discussion by mpd12 with 6 Replies.
 Last Update: February 23, 2006, 6:59 am
 
bookmark - Php / Mysql Database Connection / Creation Problems  
Quickly Post to Php / Mysql Database Connection / Creation Problems  w/o signup Share Info about Php / Mysql Database Connection / Creation Problems  using Facebook, Twitter etc. email your friend about Php / Mysql Database Connection / Creation Problems Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Hi, I'm new to Trap17.

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]

   Wed Feb 22, 2006    Reply         

hey when your setting up your data base just import the data base file, and your don.

   Wed Feb 22, 2006    Reply         

there are proplem in config file

   Wed Feb 22, 2006    Reply         


Hmmmm, the code looks ok to me, but if it's not working, It'll show up where you are querying mysql.

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.
:huh:
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 ;)

   Wed Feb 22, 2006    Reply         

Did that for both MySql queries, got the following error message:

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.

   Thu Feb 23, 2006    Reply         

There is an 'xpanel' for the accounts at the trap17.net facilities. In order to have a database on the account, go to the xpanel and 'Create DB'. It will give you the number for the database. Then use this number and the rest of the supplied information in your script. At least I think this is how it works.

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.

   Thu Feb 23, 2006    Reply         


Thanks jlhaslip!!

All sorted now!!!

All those settings were in the confirmation email I was sent too, didn't bother to read it!

   Thu Feb 23, 2006    Reply         

Quickly Post to Php / Mysql Database Connection / Creation Problems  w/o signup Share Info about Php / Mysql Database Connection / Creation Problems  using Facebook, Twitter etc. email your friend about Php / Mysql Database Connection / Creation Problems Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Similar Topics:

Php And Mysql Programming

hi everyone! I am making a program using php and mysql...I am a noob on this so i need your help guys...I want to make a simple program that will some values and then store them on a database and then retrieve them...uhmm let me give an example out put of what i need. T ...more

   05-May-2008    Reply         

Best Php And Mysql Editor For Noobs

hi there guys, from my previous posting, i am a noob in php and mysql programming. I want to know if there are any php and mysql editors which are best for me as a noob. i appreciate your kindness ...more

   06-May-2008    Reply         

remote server connection JSP and ...

remote server connection - JSP and MYSQL as a remote server database?Setting Up A Remote Mysql ConnectionCan anyone tell me how to create the connection between the JSP and MYSQL as a remote server database. I am confused with the DSN creation and connection string.-question by pallavi ...more

   25-Feb-2009    Reply         

File .class    File .class (3) (1) Help ! Trouble Installing A Blog using MySQL database  Help ! Trouble Installing A Blog using MySQL database