sentora / sentora-core

Sentora is a web hosting control panel written in PHP for *NIX
GNU General Public License v3.0
653 stars 444 forks source link

MySQL Database Name length Limit #176

Closed xabixab closed 10 months ago

xabixab commented 9 years ago

If the client name is too large (More than 15 characters) you can't create databases. I think that database (preffix + database) Max length have to be limited.

Sorry for my bad English.

TGates71 commented 9 years ago

We will look into it. After checking their site 64 is the max. @MBlagui @5050 @motters @Caffe1neAdd1ct

xabixab commented 9 years ago

I think that in phpmyadmin, you only can make one of 16 Characters.

PhilipMcGaw commented 9 years ago

This is a limit of MySQL not anything else.

There is no workaround other than truncating databases and usernames to the maximum number of characters accepted.

Philip McGaw www.philipmcgaw.com 07969502077

@Philip_McGaw

On 26 Jun 2015, at 22:25, Xabi Xab notifications@github.com wrote:

I think that in phpmyadmin, you only can make one of 16 Characters.

— Reply to this email directly or view it on GitHub.

Caffe1neAdd1ct commented 9 years ago

Apologies if I'm not following 100% on my phone at the minute...

I would suggest truncation is unexpected functionality for a user. Shouldn't the php back end validate the length of the entered data and if not prompt the user for a change which would pass validation?

Might be worth implementing if not already. On Jun 26, 2015 10:50 PM, "Skippy" notifications@github.com wrote:

This is a limit of MySQL not anything else.

There is no workaround other than truncating databases and usernames to the maximum number of characters accepted.

Philip McGaw www.philipmcgaw.com 07969502077

@Philip_McGaw

On 26 Jun 2015, at 22:25, Xabi Xab notifications@github.com wrote:

I think that in phpmyadmin, you only can make one of 16 Characters.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/sentora/sentora-core/issues/176#issuecomment-115900355 .

KaidenP commented 9 years ago

And/or perhaps you could have a limit for both usernames and mysql names, configurable in settings.

eByte23 commented 9 years ago

There shouldnt not be a trucation on username the php needs to validate it. personally i dont think you should be restricting usernames to 16 chars more appropriate would be 24 or 30 then. then if the user name is longer than the prefix amount allows create a short name.

use tge short name where all user prefixes occur or just db names but ahort user down add ~1,~2 to the end of user incase of duplicate shortnanes

eByte23 commented 9 years ago

should not truncate*

PhilipMcGaw commented 9 years ago

The length limit is a feature of MySQL.

how would hiding the truncation from the user help? They would need to enter the "short name" in any application they install… the long name is meaningless.

This is a hard limit and can not be configured out.

If you feel that it should be changed ask oracle to change it in MySQL.

Philip McGaw www.philipmcgaw.com 07969502077

@Philip_McGaw

On 27 Jun 2015, at 05:49, Elijah Bate notifications@github.com wrote:

should not truncate*

— Reply to this email directly or view it on GitHub.

KaidenP commented 9 years ago

I think that your idea is a good one @ebyte123, but it should be a 2 or 3 digit hexadecimal, or an alphanumeric, preferably randomly generated.

Or, building on what @PhilipMcGaw suggested, we have a unique id for each user, and whenever sentora encounters this, it resolves it to a human friendly name, similar to what Linux does with uid's. However, this would require some major changes in the code, and probably wouldn't be backwards compatible.

MBlagui commented 9 years ago

as we should have a prefix in mySQL user this would be an issue agree. The input field for user name should be truncated to MAXuser length allowed by MySQL/mariaDB minus current user name. We should also limit a bit user names length so we don't have bugs popping up as we implement prefixes everywhere. ( MySQL user / FTP ).

When limiting max char in input box we will not truncate, that will require more control for the valid user length here entered and append the user prefix ( name ) so we remain in mySQL allowed limit.

Also we should limit user name. 12-16 ( CPANEL already do that and now you see why!).

Set MySQL user name as : user + name set by user ( zadmin_wp ) .

Setting up a random prefix is not a solution that must users may love or we assign that a random unique prefix for each user of 3-4 characters that will be then used for all prefixes.

M B

TGates71 commented 9 years ago

Maybe change the prefix to the UID like other services do? This is normally much smaller than an actual user name prefix. This will still group DB names together and a simple module could be made to convert UID_DBNAME to USERNAME_DBNAME for reference purposes for the sysadmin.

xabixab commented 9 years ago

@TGates71 I think that is a good idea.

Caffe1neAdd1ct commented 9 years ago

The upgrade of existing applications would need to be thought about carefully as changing a load of database names would stop all applications working until their configurations have been updated.

Using the UserID would shorten the database name lengths :+1: Not truncating, alert the user and ask for a shorter database name on creation attempts

Any other ideas to add to MySQL database functionality?

Dukecitysolutions commented 10 months ago

V.2.0.0 deals with this issue by limiting username. MySQL has a limit before 5.7. Sorry not a Sentora issue! Closing for now.

TGates71 commented 10 months ago

Also, could set the username field only accept x characters including the prefix.

Dukecitysolutions commented 10 months ago

Tom, let me know when’s it’s done!

TGates71 commented 9 months ago

Max characters has already been completed. I just tweaked it a bit to include user name prefix for the db user name. Will send you the code.