Cannot connect to MySQL

Status
Not open for further replies.

muimse

New Member
Messages
28
Reaction score
0
Points
0
Hi,

I created a website that use MySQL connection.
When I finished creating the website, I upload it to my webspace and tested it. Everything went well. However, several month later, I found that I cannot access to MySQL.
It said that

mysql_connect() [function.mysql-connect]: Access denied for user 'xxxxxxx'@'localhost'

So I just wonder is there any restriction on using mysql_connect function for this webspace? Also, I did try to create a new user account for this database. It still did not work.

Since I used to use this function on the space and it worked well, I am not sure whether there is some new restriction on using this function.

Thank you very much,

muimse
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
Are you trying to access the database remotely ?
If so then the firewall is setup to block all outside connections.
 

muimse

New Member
Messages
28
Reaction score
0
Points
0
The way I did is that I created a PHP page that connect to the database by using mysql_connect like the following

$user = "username";
$passwd = "password";
$host = "localhost";

mysql_connect($host,$user,$passwd)

Then, put the page onto the www or public folder.
The error said:

Access denied for user 'username'@'localhost' (using password: YES) in /home/muimse/public_html/.../.../my_page.php

It worked like several months ago but not now.
By the way, I forgot to login forum for couple weeks, so my account got suspended.
After getting unsuspended, the database connection does not work then.

Do I need to make any change to get it work?

Thank you,

muimse
 
Last edited:

tnl2k7

Banned
Messages
3,131
Reaction score
0
Points
0
For the username, are you using muimse_username? cPanel automatically adds your username and an underscore to the username for obvious reasons.

-Luke.
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
Please try and recreate the mysql user and assign it all privileges to the database.
 

muimse

New Member
Messages
28
Reaction score
0
Points
0
oh I see.

It works now. It turns out that I have to set all privileges to the username.

Thank you very much. I do appreciate your help.

Phichet
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
Not a problem, its what we are here to do :)
Closing this thread, please feel free to open a new one if you encounter further problems.
 
Status
Not open for further replies.
Top