Powered by Invision Power Board


  Reply to this topicStart new topicStart Poll

> First timer with MYSQL
mrickert
Posted: Aug 25 2004, 11:31 AM
Quote Post





Group: Members
Posts: 82
Member No.: 346
Joined: 2-December 03



I could use a little help. I've created a simple MySQL database, and I'm just trying to connect to it. This is my PHP page:
CODE

<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
      <title>Trying to connect to a database</title>
</head>
<body>
<?
mysql_connect("localhost","username","password") or die
             ("Unable to connect to SQL Server.");
             
mysql_select_db("whp") or die("Unable to open database: whp");

$query= "SELECT ModelNum(*) FROM Model";
$model_result= mysql_query($query) or die ("Can't find the Model!");
?>
<br><br>
Model.ModelNum is : <? echo $query; ?>
</body>
</html>


I have changed "username" and "password" with correct values in the real page. Anything seem wrong with this? All I see when pulling up the page is:

Warning: Access denied for user: 'username_changed@localhost' (Using password: YES) in /home/webadmin/vvapplianceparts.com/html/test.php on line 8

Warning: MySQL Connection Failed: Access denied for user: 'username_changed@localhost' (Using password: YES) in /home/webadmin/vvapplianceparts.com/html/test.php on line 8
Unable to connect to SQL Server.

I feel like I may be missing an initial step somewhere.
Thanks
Matt
PMEmail Poster
Top
Matt
Posted: Aug 25 2004, 03:51 PM
Quote Post





Group: Members
Posts: 1,103
Member No.: 342
Joined: 25-November 03



I have looked at the php script on the server. The mysql_connect line in the script code appears to be setup correctly. However, it appears that no mysql username exists with the password that is found within the script.

To see what usernames you have set up in mysql:
1) Log into a shell prompt at your server as root.
2) Log in as root using the following command:
mysql -uroot -p
3) Enter your password and press your enter key.
4) Run the following commands:
use mysql;
show tables;
select * from user;

You should then see a list of user names and encrypted passwords. If your user does not exist you will need to create that user.

For more information on how to create user names in mysql see:

http://dev.mysql.com/doc/mysql/en/Adding_users.html

If you are having further problems please send an email to support@advantagecom.net with your root mysql username and password and I will look further into this problem.


--------------------
Matt B.
Advantagecom Technical Support

Private messages are ignored unless solicited. If you have a support question, please email support@advantagecom.net, post in the appropriate section of the forum, or call if your service plan allows support by phone.
PMUsers Website
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll