This error occurs because you used an excessively long username when creating the database; MySQL has a limit on username length – typically, a username should not exceed 16 characters.
To resolve this issue, you can either create a database using a username no longer than 16 characters, or you can create a user on the MySQL server that supports longer usernames and assign this user to the database.
If you are using cPanel or another control panel, there may be an interface that can help you easily create users and databases. If you choose to create them manually, you can use the following SQL commands to create a new user and assign them to a database:
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON `dbname`.* TO 'newuser'@'localhost';In the above example, you need to newuser Replace with a username no longer than 16 characters,password Replace this with the password you want to set for the user.dbname Replace this with the database name you wish to assign to the user.
If you haven't yet created a database to assign to a new user, you should first use it. CREATE DATABASE Run the command to create it, as shown below:
CREATE DATABASE dbname;among,dbname The name of the database you want to create.