Updated: 11 October 2026 · Applies to: Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9

Very old MySQL versions (5.6 and earlier) allowed user names of at most 16 characters; longer names failed to log in. Current versions allow longer names:

  • MariaDB (default on AlmaLinux, Rocky, Ubuntu and Debian): up to 80 characters.
  • MySQL 5.7.8 and later, including 8.x: up to 32 characters.

If a login fails because of the name

  1. Check the server version: mariadb --version or SELECT VERSION();.
  2. List the existing accounts and compare the exact name: SELECT User, Host FROM mysql.user;.
  3. If the name is too long for the server, create a shorter one and give it the same rights: CREATE USER 'shopapp'@'localhost' IDENTIFIED BY '…'; GRANT ALL ON shopdb.* TO 'shopapp'@'localhost';
  4. Update the application's configuration file with the new user name.

On cPanel hosting, database user names start with your account prefix (for example cpuser_), which counts towards the limit. Keep the part you choose short.

Other causes of the same "access denied" error are a wrong password, a user created for localhost while the application connects to 127.0.0.1 or another host, or a user without rights on the database. SHOW GRANTS for the account shows what it may do.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket