Access denied for user 'beernice'@'localhost' to database '_simple_login'

Status
Not open for further replies.

beernice

New Member
Messages
4
Reaction score
0
Points
0
Hi, i am trying to connect to the data base "simple login" on the php admin section of my control panel. The php code is below

PHP:
<?php 
 mysql_connect("localhost", "beernice", "password") or die(mysql_error()) ; 
 mysql_select_db("_simple_login") or die(mysql_error()) ; 
$name=$_POST['name'];
$email=$_POST['email'];
$address1=$_POST['address1'];
$country=$_POST['country'];
$username=$_POST['username'];
$password=$_POST['password'];
$password2=$_POST['password2'];
 
 
 ?>

However, the following error message appears.

Access denied for user 'beernice'@'localhost' to database '_simple_login'

Do i need the port number, or is the code incorrect?:confused:
 
Last edited by a moderator:

Anna

I am just me
Staff member
Messages
11,739
Reaction score
579
Points
113
The database should be named in such way that it is prefixed with your cPanel username, meaning its proper name would be 'beernice_simple_login'

I'd also recommend that you create a specific database user in cPanel to use with the database, don't forget to add it to the database with proper permissions, see http://x10hosting.com/wiki/How_to_Create_a_MySQL_Database_and_User for more information on how.
 
Last edited:

beernice

New Member
Messages
4
Reaction score
0
Points
0
Thanks for the post and the link. I created the database in phpmyadmin which I now realise i can't do!:frown:. I will try the wizard.

Thanks again:smile:
 
Status
Not open for further replies.
Top