Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using codeigniter database dbforge class I have created a database and loaded that database as the current database and created tables in localhost WAMP server. But when I uploaded it to the server I am not able to create the database using dbforge class.


This command line gave me the following error:

Error No 1044: Access denied for user 'username'@'localhost' to database 'database_name'    

I am using the 'cpanel' hosting provider .

EDIT1: How we can give permission for a mysql user to create database in cPanel hosting provider...?

EDIT2: The Privileges list of user does not show 'CREATE DATABASE' Privilege in Cpanel. The user is created through cPanel and it have been given all the available privileges, but the CREATE DATABASE privilege is not available in that list in cpanel.

share|improve this question

migrated from Sep 6 '12 at 9:26

This question came from our site for professional and enthusiast programmers.

It clearly states that specified user don't have permission to create database on the server. – Deepak Sep 4 '12 at 10:59
how we can give permission to create database to a user..? – user1645846 Sep 4 '12 at 11:43
@user1645846 - are you able to create additional databases via the cPanel? – stealthyninja Sep 4 '12 at 13:54
@stealthyninja- yes i am able to create database through cpanel. And i have to add a user to that newly created database through Cpanal to access that database. But while creating database using dbforge class it gives access denied error. – user1645846 Sep 5 '12 at 4:35
Is your DB user name is really "username"? Seems like you haven't changed default DB connection config. – webbandit Sep 5 '12 at 5:40

Using C-Panel / WHM, you create databases on a per application basis. Let's say that your c-panel username is john123 and you were installing a blog. You'd do the following:

  1. Go to c-panel -> databases -> and create the database john123_blog
  2. Go to databases -> users and create a user to access it john123_blogu
  3. Add the user to the database, and give them the appropriate permissions

At that point, you can use the dbforge class to create tables within the database. In a shared hosting setup, users are often limited to how many databases they can have, so database creation itself has to go through the automation software (in this case, c-panel).

There's nothing wrong with your code, it's just assuming a non-shared environment.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.