Could not connect Mysql database

How to use phpmyadmin.... phpmyadmin related arguments. Even phpMyAdmin issues

Moderators: macek, egami, gesf

bijiforyou
New php-forum User
New php-forum User
Posts: 2
Joined: Fri Apr 25, 2014 10:16 pm

Could not connect Mysql database

Postby bijiforyou » Fri Apr 25, 2014 10:26 pm

Dear..
I am try to connect MySQL Databases in our website. but i can't connect. that time shows one message.
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'pearlde_admin'@'199.79.62.144' (using password: YES) in /home/pearlde/public_html/connection.php on line 2
Could not connect: Access denied for user 'pearlde_admin'@'199.79.62.144' (using password: YES)


My code is :

<?php
$con = mysql_connect("*.*.62.144","username","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database name", $con);
?>

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: Could not connect Mysql database

Postby seandisanti » Sat Apr 26, 2014 8:08 am

a few things:
1) mysql_ functions are deprecated because they are slow and insecure. You should be using PDO or mysqli_ functions at the very least.

2) redacting the ip address and username in the code is less effective when you leave it in the error message :D

3) the error message you're getting lets you know that your attempt was explicitly denied by the server, that tells you that it's not a communication issue because you're receiving the response.

Most likely your user is not setup and given permissions in the database. if you have mysql console access, you can give permissions by going into console and typing the following commands:

use mysql;
GRANT ALL privileges on database_name to to username identified by password('password');

if you don't have console access, you're probably going to have a setting in cpanel for mysql databases and database users. in that interface you have to create a user, and then explicitly link them to a database and select permissions. I'm sure there are other interfaces also, so let me know if you're still having issues (and remove your info from the quoted error message)

bijiforyou
New php-forum User
New php-forum User
Posts: 2
Joined: Fri Apr 25, 2014 10:16 pm

Re: Could not connect Mysql database

Postby bijiforyou » Sun Apr 27, 2014 8:40 pm

Thnks for replay..

Now its working...

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: Could not connect Mysql database

Postby seandisanti » Mon Apr 28, 2014 8:23 am

No problem, I'm glad to hear it


Return to “phpMyAdmin”

Who is online

Users browsing this forum: No registered users and 1 guest