Can't connect to MySQL DB

Status
Not open for further replies.

codegee3

New Member
Messages
4
Reaction score
0
Points
1
Hi,
I am in the process of bringing my website out of development (off of my localhost) and onto a web host. I setup the database, uploaded my PHP files, and modified my connection.php file (which is where I connect to the DB) with the correct information for the newly created DB. However, when I go to my site, I get an error:

Warning: mysqli_connect(): (42000/1044): Access denied for user 'codegee3_luigi'@'198.91.81.7' to database ' codegee3_codegeek' in /home/codegee3/public_html/connect.php on line 9

Connection failed: Access denied for user 'codegee3_luigi'@'198.91.81.7' to database ' codegee3_codegeek'
 

codegee3

New Member
Messages
4
Reaction score
0
Points
1
Also, here is my connect.php file:

PHP:
<?php
/**
* Created by PhpStorm.
* User: Luigi Battaglioli
* Date: 6/27/2017
* Time: 4:55 PM
*/
$username = 'codegee3_luigi';
$password = 'my password';
$database = 'codegee3_codegeek';
$host = 'codegeek.pcriot.com';

// Create connection
$conn = mysqli_connect($host, $username, $password, $database);

// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
 

bdistler

Well-Known Member
Prime Account
Messages
3,534
Reaction score
196
Points
63
x10hosting's free-hosting database SQL_HOST name --> [ localhost ]

try --> [ $host = 'localhost'; ] - without the brackets
###
 

codegee3

New Member
Messages
4
Reaction score
0
Points
1
x10hosting's free-hosting database SQL_HOST name --> [ localhost ]

try --> [ $host = 'localhost'; ] - without the brackets
###

Hmmm, now it just says:

Warning: mysqli_connect(): (42000/1044): Access denied for user 'codegee3_luigi'@'localhost' to database ' codegee3_codegeek' in /home/codegee3/public_html/connect.php on line 9
Connection failed: Access denied for user 'codegee3_luigi'@'localhost' to database ' codegee3_codegeek'
 

bdistler

Well-Known Member
Prime Account
Messages
3,534
Reaction score
196
Points
63
I 'see' a space after first quote in [ to database ' codegee3_codegeek' ]
###
 
Status
Not open for further replies.
Top