Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Maged's avatar
Level 6

Mulit tenancy issue with multiple databases

I'm using this package[https://tenancyforlaravel.com/] to make multi tenancy possible, each time i create new tenant i got new database, working great locally

But when i moved to live server/cpanel i get

SQLSTATE[42000]: Syntax error or access violation: 1044 Access denied for user 'test'@'localhost' to database 'tenantnew' (SQL: CREATE DATABASE `tenantnew` CHARACTER SET `utf8mb4` COLLATE `utf8mb4_unicode_ci`)

how to solve this issue ? how do people create multiple databases and still have access to the new database ? i tried to use the cpanel user itself and still didn't work

0 likes
5 replies
bugsysha's avatar

Multitenancy with separated databases is not smart for projects where you have full control. I don't understand how you plan to do it on CPanel. Since you've decided to torture yourself with that complicated approach, at least you can spare yourself further problems and get a VPS or even a dedicated server.

martinbean's avatar

@maged If you’re using cPanel then that suggests you’re using shared hosting, and a shared host isn’t going to let you create databases like this.

They don’t want you spinning up 1,000 new databases if you get 1,000 customers. The real question is: why do you? Do you want to be managing and maintaining and migration 1,000 databases just because you have 1,000 customers?

Maged's avatar
Level 6

@martinbean I have a Learning management system which is already working, each new client i have to deploy the project for them as a new one, so i though of multi tenancy, but having a single database would require many changes in current structure and code base so i thought of multiple databases, as i'm also not expecting that many clients, so do you think it's better to work on single database ? or use a vps instead

Maged's avatar
Level 6

even if i decided to use single database, would the Cpanel accept to use subdomain for each new customer ? or will still face same issue

musheabdulhakim's avatar

You can use sqlite as your database depending on the traffic to your project. I used was having the same issue. I couldn't get the user permission problem to work so switched to sqlite.

Please or to participate in this conversation.