MySQL Setup, 1 or many?

theMikeroy

Member
Oct 6, 2006
10
0
151
Just curious...

With regard to how cPanel handles all of the sub-client's mysql databases, does cPanel itself use a single MySQL instance, and run all the db's from that, or does each user initiate their own mysql processes?

I'm curious, becase i was looking to build a multi-computer cpanel hosting setup where the mysql db's were on a seperate host (the computer's would be side-by-side, mind you), and i want to know how i should properly handle the backups for the DB's.

Any info is appreciated!
Thanks!
 

eth00

Well-Known Member
PartnerNOC
Mar 30, 2003
721
1
168
NC
cPanel Access Level
Root Administrator
It is just a standard copy of mysql, you can even install a copy from mysql.org. It does not do any sort of fancy chrooting or other things that might make your life difficult for what you are trying.
 

theMikeroy

Member
Oct 6, 2006
10
0
151
Right, it's just mysql.

Is it 1 instance of it running, with every client hosted on the machine using the same process, or does each domain have their own instance of MySQL running?

Backing it up is trivial, i just need to know am i backing up 1 database with a dozen users, or a dozen users with a dozen databases?

I know that cPanel automatically uses a prefix for domains to identify the user associated with it (user_mysqldb, user_mysqldbuser, etc...), but again, it is 1 database, or many?
 

eth00

Well-Known Member
PartnerNOC
Mar 30, 2003
721
1
168
NC
cPanel Access Level
Root Administrator
It is just a standard install of mysql with no chrooting - it all runs from the mysqld process.

If you take a look in phpmyadmin or /var/lib/mysql it is apparent that each database is separate. If a user has 3 databases created all 3 will be regular databases on mysql.

You are backing up dozens of users and even more dozens of databases.
 

freedman

Well-Known Member
Feb 13, 2005
314
5
168
Right, it's just mysql.

Is it 1 instance of it running, with every client hosted on the machine using the same process, or does each domain have their own instance of MySQL running?

Backing it up is trivial, i just need to know am i backing up 1 database with a dozen users, or a dozen users with a dozen databases?

I know that cPanel automatically uses a prefix for domains to identify the user associated with it (user_mysqldb, user_mysqldbuser, etc...), but again, it is 1 database, or many?
the user access information is in one place and run from one instance of mysqld
> ps -eaf | grep mysql
will show 1 instance with a child.

each user, will have their own database(s), but accessed through the same mysql instance.

You want them to access databases on a remote machine: db.USERDOMAIN.XXX or db.hostingcompany.net -- you'll have to do some manual work, I believe.
The issue is, cpanel just assumes you only have one machine... when the user creates a database through their user control panel, it runs a cpanel script which creates the database and adds the user id to the local mysql on this machine.

So, if you're going to run the DB's from a separate machine, then you'll have to replace this functionality within cpanel and write your own script which adds the users DB/access info to your remote database.

you can browse around for how to add custom controls to the user cpanel.
if you relaly want to have your users using DB's on remote machines, it's probably worth doing this development --you only have to write this code once.--it's possible if you search around, you'll find someones done this, but I havn't searched so I dont know for sure.

hope that answers your question.