cPanel & WHM Version 100 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

Change default MySQL databases location to the account folder instead of root partition

Benjamin D. shared this idea 4 years ago
Not Planned

As a web hosting provider I would like cPanel to move the storage of a users databases to their /home/user/ directory, to make it easier to copy them between servers.

Replies (4)

photo
2

Just to further clarify my point of view: A lot of losing hosting companies do not open SSH ports to us to help with the transfer of hosting accounts. The fastest way to transfert server-to-server for now that works universally is by FTP over SSH on the winning server. That being said, MySQL databases are the only component that sits outside of the user directory, making it more complicated to transfer. Having it in the user dir would enable grabbing it along with all the rest in a single FTP operation.

photo
1

Why would you need the databases files ? Isn't doing a mysqldump a more reliable method ? In most cases you then either have access to cPanel to download a mysqldump or you can run it from a PHP or Perl script.


I agree that a way to transfer accounts from one cPanel server to another with only the users credentials makes a lot of sense. Maybe cPanel could work out a way that doesn't require SSH and uploads a script via SFTP or FTP to launch the backup maybe with UAPI and transfer the files and databases automaticaly ?

photo
1

When using the transfer tool to perform a transfer using the user credentials we use the API to initiate a backup. If it fails it can indicate the backup feature is disabled (which is true on some hosting providers).

photo
1

On a lot of them *

photo
1

Monarobase, yes, the real underlying issue is: how to simplify the database moving. I understand creating a dump and importing it is the only real way of doing it at the moment, but it consumes so much time, look at this workflow, it's just incredibly painful:

1) Open the website's config file (Wordpress or whatever) and take note of the DB name, user and pass.

2) Produce a MYSQL dump via the old server's cPanel.

3) Move the dump file to the user dir where a FTP connection has access to it.

4) Transfer the dump (via server-to-server FTP) to the new server.

5) Connect to cPanel on the new server and create the database.

6) Create a user for that database.

7) Link the new user you just created to the DB.

8) Set the user priviledges.

9) Over SSH (since I only got 800kbps upload speed) import the dump file in MYSQL using #6 credentials.

Like, WTH?

Now look at this workflow for EVERYTHING ELSE altogether:

1) Copy the user directory (via server-to-server FTP) to the new server.

... and you're done. All email accounts were in user/etc/ so that's done. All email directories were in user/mail/ so that's done. All website files were in user/public_html/ so that's done. Why 9 steps per database and just 1 step for EVERYTHING ELSE all at once lol.

photo
1

It's not just a matter of copying the files, the correct way to do what you are suggesting is :


1) Stop MySQL on source server

2) Copy files accross

3) Start MySQL on source server

4) Restart MySQL on the destination server

5) Run MySQL upgrade on the destination server to update the files to the correct version

6) Run a repair of database if the files were being written while you were downloading them


Seems faster and more reliable to :

1) Upload and run a mysqldump script

2) Copy all files

3) Import the mysqldump files


Maybe something intermediate between the two solutions could be achived ?

photo
1

You're missing steps about the database credentials that you have to obtain and recreate even prior to using an uploaded dumping script.

photo
1

Yes, I agree, there should be a way to get these. Maybe have them stored in a file on the user account that can be easily reimported.

photo
1

I'm totally aware that this issue is WAY more complex to solve than just moving the database files in the user directory instead of var dir, but at least we're discussing it to help raise some sort of flag that this will need to change at some point if cPanel is meant to be an easy management platform.

The API and/or SSH access is more often than not BLOCKED by losing hosting companies, therefore I find that moving MYSQL databases is the most time consuming thing left to simplify when moving an account in from another server.

photo
1

Hey all! Thanks for the discussion here, and allowing us to get to the root of the problem.


Speaking to the original request, this is something we're not likely to consider for a few different reasons. The biggest concern to us is the potential for database corruption if a user hits their disk quota.


I'm going to go ahead and mark this as not planned at this time, but I'll bring up the concern at our next planning meeting. If either of you have any questions, please feel free to let me know!

Replies have been locked on this page!