Issue after migrating from cPanel

nitaish

Verified User
Joined
Jul 8, 2019
Messages
8
I was testing DirectAdmin and tried to migrate a cPanel account to DirectAdmin. The migration went smooth but then I found that the MySQL user did not get created during the restoration. I created the MySQL user manually using the same credentials and did not face any issue. What could be the reason for the MySQL user not getting created during restoration from cPanel backup?
 
Hello,

Did you do this before migration?

/usr/local/directadmin/directadmin set max_username_length 16 restart

Thanks,
Melih
 
Am I correct in that DirectAdmin uses the full username as the prefix for a database and database username? If I'm wrong in this regard then my rant below is irrelevant.

cPanel (stupidly) began allowing long usernames, but the first 8 characters had to be unique in order to hang on to database prefix requirements (which to be fair... at the time, whatever MySQL version they were operating under had a strict MySQL username/db name limit).

So if you have a user (on cPanel) with the username - iamalongusername - and they create a database called db1, then the username prefixed database would be iamalong_db1. But as this is transferred over to DirectAdmin the database name becomes - iamalongusername_db1 which now differs from all of the config setup that the user has setup, which uses iamalong_db1.

The idea for long usernames with cPanel was stupid and ill-advised... but they did it anyway. What's the point of having long usernames if the first 8 characters have to be unique? What's the point of having long usernames if the username prefix is restricting database creations? cPanel listened to someone that wanted a feature request and did it without any thought process at all.

A better solution might be to set the max_username_length to 8 in DirectAdmin and trim all of your cPanel usernames to the first 8 characters before moving them over. Yes, the username for their FTP and panel access will change... but their WordPress and database driven websites will continue to work. At least, that's my thought without actually testing this in a real-world environment.
 
@sparek, it's described here:
http://forum.directadmin.com/showthread.php?t=58059 said:
* DirectAdmin format for mysql usernames/databases is always username_database and username_user. cPanel has the same format, but due to max username/database length (https://forums.cpanel.net/threads/us...limits.630671/), is sometime shortens the username part in from of it. cPanel allows myusername_ to have a DB username with myuserna_. DA DB names/usernames always start with myusername_, changing this would create a mess, for example, you could have myuserna user owning myuserna_db1 and myusername user owning myserna_db2. The script converts username to be username in such cases, so, for some accounts you might need to change database username/name in wp-config.php or other files CMS uses. This should be rare though. Script output in such cases:
Code:
WARNING! us_wordpress cannot be owned by user, renaming database user to user_wordpress

MySQL 5.7+ allows 32 chars MySQL usernames, MariaDB 10.x - 80, so, this should really be enough :)
 
I was basically pointing out how cPanel's decision to allow longer usernames when relying on a MySQL version (I forget which) but only allowed for like 16 character MySQL usernames (I forget the exact figure here as well). Which I know is beyond the scope that DirectAdmin really cares about.

I don't really know why a Linux username needs to be longer than 8 characters anyway, especially since that's the cutoff for uniqueness in cPanel.

Bottom Line: If all of your users on a cPanel server are at most 8 characters... you won't have any issues transferring those users from cPanel to DirectAdmin.
 
Back
Top