Database Error

Status
Not open for further replies.

masterb163

New Member
Messages
2
Reaction score
0
Points
0
Hey I was trying to install a database script to my free hosting with you all, but when I tried to install it I got this message. Database connection failed!
Double-check all the information below. If not sure contact your hosting company for the correct information!
MySQL said: Access denied for user 'cbryant2'@'int.web3.vital.x10hosting.com' (using password: YES), I haven't reached the allowed databases yet at least I don't think I have could you tell me whats going on. FYI: I did use the correct login credentials.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
1. Make sure the host is 'localhost'
2. In general, you connect using the database user you created in MySQL Databases and then attached to the database with ALL PRIVILEGES
The username is of the format cbryant2_igor .
3. You can connect using cPanel username and password, but that is not usual.
4. A simple script that should work to make sure all your info is correct:

PHP:
<?php
$host = 'localhost' ;
$db = 'gerbil_dbname' ;
$user = 'gerbil_dbuser' ;
$pass = 'SayTheSecretWord' ;
echo "<pre>" ;
try {
    $dbh = new PDO("mysql:host=$host;dbname=$db", $user, $pass);
    foreach($dbh->query('SHOW TABLES') as $row) {
        echo $row[0] . "\n" ;
    }
    $dbh = null;
} catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "<br/>";
    die();
}

echo "</pre>";
 

masterb163

New Member
Messages
2
Reaction score
0
Points
0
It looks like the issue is resolved I just created a new database user, instead, of using my cPanel login.
 
Status
Not open for further replies.
Top