Web Hosting Forum | Lunarpages
News: October 6, 2008 - Submit Your Site for the October 2008 Site of the Month!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 13, 2008, 03:11:53 AM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: Problems connecting to mysql database on my server  (Read 670 times)
quentiz
Newbie
*
Offline Offline

Posts: 1


« on: May 24, 2007, 08:00:48 AM »

I have tried to connect to the mysql database that is on my server through a php script connection and dreamweaver, but I continuous get this error.

Mysql Error#: 1045

Access denied for user ‘admin’@localhost (using password: YES)

However, I can connect to the mysql database through shell and phpmyadmin that plesk provides.  I know that I am using the correct username and password because I created them.  I have actually created several different usernames and passwords and they all have failed to connect through the php scripts. 

In addition, when I create a user with shell this user does not show up in the plesk interface under users of a particular database.

Furthermore, when I first attempted to use the phpmyadmin through plesk it asked me to update my priviledges table with this command:  “mysql_fix_privilege_tables”.  Which I did.


Here is the script I am using

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname = "localhost";
$database = "cn";
$username = "admin";
$password = "mypassword";
$connection = mysql_connect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR);
?>

Simply put, can someone offer any advice on how I can connect to the mysql database on my server?
Logged
perestrelka
Administrator
Master Jedi
*****
Offline Offline

Posts: 1058



« Reply #1 on: May 24, 2007, 10:14:20 PM »

Hello,

I would not recommend to use login 'admin' for your MySQL user because such user is used by Plesk to manage MySQL server. This means that you added a duplicate user with such name and more than likely this is causing the access denied error.

To get a database user listed under a specific database in Plesk, you need to create the user via Plesk. If a database login was created via shell, Plesk has no idea which database it should show the user under.

Please try to use a user created via Plesk to connect to MySQL through PHP and Dreamweaver and let me know about the result.

I hope this is helpful.
Logged

Kind Regards,
Vlad Artamonov
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.6 | SMF © 2006-2008, Simple Machines LLC

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM