How to fix ERROR 1410: Not allowed to create user with GRANT in MySQL
MySQL 8.0+ does not allow creating users implicitly through GRANT statements. You must create the user first with CREATE USER, then grant privileges separately.
Quick fix
Fixes 1410
GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost' IDENTIFIED BY 'password';- Separate CREATE USER from GRANT statements
- Flush privileges if changing grants
- Verify the user was created successfully
- Update legacy scripts and migrations
GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost' IDENTIFIED BY 'password';ERROR 1410: Not allowed to create user with GRANT
What this error means
In MySQL versions prior to 8.0, you could create a new user and assign privileges in a single GRANT statement. Starting with MySQL 8.0, this behavior was removed for security and clarity reasons. When you attempt the old syntax (combining user creation with GRANT), MySQL returns ERROR 1410 because it no longer supports implicit user creation through GRANT statements. This enforces a clearer separation of concerns: user creation is handled by CREATE USER, while privilege assignment is handled by GRANT. Additionally, this error can occur when a user without the GRANT OPTION privilege attempts to assign privileges to another user, preventing privilege escalation attacks.
Typical symptoms
- GRANT statement fails with 'ERROR 1410' when trying to create a new user
- Migration scripts or deployment tools fail during database setup
- Application initialization code fails when setting up database users
- Cannot create users in MySQL 8.0+ using syntax that worked in MySQL 5.7
Common causes
- Attempting to create a user and grant privileges in a single GRANT statement (MySQL 8.0+ requires separate statements)
- Running old database initialization scripts written for MySQL 5.7 on MySQL 8.0 or later
- A user without the GRANT OPTION privilege attempting to assign privileges to another user
- Not having the CREATE USER privilege required to create new user accounts
How to fix "ERROR 1410: Not allowed to create user with GRANT"
Replace single-statement syntax with two separate commands. Instead of:
GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost' IDENTIFIED BY 'password';Use the MySQL 8.0+ syntax:
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost';The CREATE USER statement creates the account first, then GRANT assigns privileges to the existing user.
After running GRANT statements, execute FLUSH PRIVILEGES to ensure the changes take effect immediately:
FLUSH PRIVILEGES;Note: In MySQL 8.0+, FLUSH PRIVILEGES is often optional (changes apply automatically), but it's a safe practice to include.
Confirm the user exists and has the correct privileges:
SELECT user, host FROM mysql.user WHERE user='username';
SHOW GRANTS FOR 'username'@'localhost';This ensures the account was created and privileges are properly assigned.
If you have SQL initialization scripts from MySQL 5.7, update them to use separate CREATE USER and GRANT statements. Search for patterns like:
GRANT ... IDENTIFIED BYAnd split them into two statements. Many ORMs and migration tools (Prisma, TypeORM, Sequelize) have features to handle this automatically—check your tool's documentation for MySQL 8.0 compatibility modes.
Advanced notes
MySQL 8.0 introduced stricter user management to improve security. The separate CREATE USER and GRANT statements allow for better audit trails and prevent accidental privilege escalation.
If you're migrating from MySQL 5.7 to 8.0, update all database initialization scripts. Some tools provide backward compatibility modes, but it's recommended to adopt the 8.0+ approach for new projects.
For applications using ORMs like Sequelize, TypeORM, or Prisma, check that your version supports MySQL 8.0+ properly. Many older ORM versions still generate legacy syntax and need updates.
Frequently asked questions
- What does "1410" mean?
- 0, you could create a new user and assign privileges in a single GRANT statement. 0, this behavior was removed for security and clarity reasons. When you attempt the old syntax (combining user creation with GRANT), MySQL returns ERROR 1410 because it no longer supports implicit user creation through GRANT statements.
- How do I fix "1410"?
- MySQL 8.0+ does not allow creating users implicitly through GRANT statements. You must create the user first with CREATE USER, then grant privileges separately.
- What causes "1410"?
- Attempting to create a user and grant privileges in a single GRANT statement (MySQL 8.0+ requires separate statements) Running old database initialization scripts written for MySQL 5.7 on MySQL 8.0 or later A user without the GRANT OPTION privilege attempting to assign privileges to another user
- Is the "1410" error serious?
- It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- 📚MySQL Official Documentation
- 📖MySQL Error Reference 8.0(Official Docs)
- 📖MySQL Blog: How to grant privileges in MySQL 8.0(Official Docs)