Welcome Guest, Not a member yet? Register   Sign In
Creating a new database is not working at server in codeigniter 3
#1

Hello everyone.
I have a accounting management project where I need to store some specific data to a new database. I am fetching a issue when I am going to create a new database in server. It is working fine in local. As this project is made with Codeigniter 3, I am using codeigniter dbforge() library to create new database.

I have made this following this documentation of codeigniter 3.
https://codeigniter.com/userguide3/datab...orge-class

But when I run this code, I get this error message.
Error Number: 1044
Access denied for user 'shohowqj_testing_usr'@localhost to database 'shohoz_hishab_backup_2022'
CREATE DATABASE shohoz_hishab_backup_2022 CHARACTER SET utf8 COLLATE utf8_general_ci

Filename: modules/yearly_closing/controllers/Yearly_closing.php
Line Number: 68

Anybody please help me how to fix it.
Thank you
Using Codeigniter since 2016 ( skype: imranertaza )
Reply
#2

Whats it say on line number 68?

You need to show your code so that we can help you.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

This is the code at that line number 68

if (!$this->dbutil->database_exists($newDb)){
$this->dbforge->create_database($newDb);
}
Using Codeigniter since 2016 ( skype: imranertaza )
Reply
#4

(This post was last modified: 05-15-2022, 01:15 PM by JustJohnQ.)

First guess is that the db user on the server doesn't have privileges to create a new database. It could be a hosting/server limitation.
Can you create a (temp) database with the user credentials in phpmyadmin or some other tool on the server?
Reply
#5

@JustJohnQ
I am using cpanel and it is shared server. I also think there is a permission issue. But I gave the full permission of the user. I am not sure what do I do next?

You can see. I have posted this question on stackoverflow
https://stackoverflow.com/questions/7223...eigniter-3

Please advise if you have any solution of that.
Thank you
Using Codeigniter since 2016 ( skype: imranertaza )
Reply
#6

As asked before:
Can you create a (temp) database with the user credentials in phpmyadmin or some other tool on the server?
I am pretty sure you don't have permissions to create and use more than one database on your server.
Reply
#7

Hi
I did not create temp database with the user credentials. But I created a main database with this user from cpanel.
But as you have confirm that it has permission issue, can you please let me know how to fix the issue?
I think you have seen that I have given the full user privileges.
Thank you
Using Codeigniter since 2016 ( skype: imranertaza )
Reply
#8

The problem might be that your hosting party doesn't allow you to create more than one database.
Hence, with user credentials, try to create a temp database.
Reply
#9

@JustJohnQ
OK, Can you please let me know how to create temp database with that user crendentials? do you have any document for that?
And how can I allow the user to create database from cpanel? I have only cpanel details.
Thank you
Using Codeigniter since 2016 ( skype: imranertaza )
Reply
#10

You never want to let a user have control of your CPanel.

Try to create a database using pure MySQLi and see if it works.

You may need to supply a username and password on the creation of the database.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB