Skip to content

Mukesh Chapagain Blog

  • PHP
    • PHP
    • Laravel
    • WordPress
    • Joomla
  • Magento
    • Magento 2
    • Magento Extension
  • Node.js
    • Node.js
    • Javascript
    • jQuery
  • Database
    • MySQL
    • MongoDB
  • Data Science
    • Machine Learning
    • Recommender System
    • Natural Language Processing (NLP)
    • Sentiment Analysis
    • Python
    • R
  • Categories
    • Blockchain
      • Hyperledger Composer
      • Hyperledger-Fabric
    • Other
      • Cryptography
      • Data Structures & Algorithms
      • Git
      • LaTeX
      • Linux
      • Ubuntu
      • Xubuntu
      • Google
      • Google AppScript
  • About
    • About
    • Contact
    • Privacy Policy

Home » Magento » Magento 2 » Magento 2: No Administrators role was found, data fixture needs to be run while creating admin user from command line

Magento 2: No Administrators role was found, data fixture needs to be run while creating admin user from command line

October 26, 2022October 12, 2021 by Mukesh Chapagain
Categories Magento, Magento 2 Tags admin, login, Magento, magento2
FacebookTweetLinkedInPinPrintEmailShares

Tried creating admin user from command line with the following command:


bin/magento admin:user:create

After completion of the command run, I got the following error in the terminal:

No Administrators role was found, data fixture needs to be run

When I try to login to the admin via browser, I get this error:

More permissions are needed to access this.

Table of Contents

Toggle
  • Cause
  • Solution

Cause

authorization_role and authorization_role database tables were empty.


SELECT * FROM authorization_role;
Empty set (0.001 sec)

SELECT * FROM authorization_rule;
Empty set (0.001 sec)

Solution

Insert data into authorization_role and authorization_role database tables.


INSERT INTO authorization_role (role_id, parent_id, tree_level, sort_order, role_type, user_id, user_type, role_name) VALUES (1, 0, 1, 1, 'G', 0, '2', 'Administrators');
Query OK, 1 row affected (0.004 sec)

INSERT INTO authorization_rule (rule_id, role_id, resource_id, privileges, permission) VALUES (1, 1, 'Magento_Backend::all', null, 'allow');
Query OK, 1 row affected (0.034 sec)

Check the tables again


SELECT * FROM authorization_role;
+---------+-----------+------------+------------+-----------+---------+-----------+----------------+------------+--------------+------------------+
| role_id | parent_id | tree_level | sort_order | role_type | user_id | user_type | role_name      | gws_is_all | gws_websites | gws_store_groups |
+---------+-----------+------------+------------+-----------+---------+-----------+----------------+------------+--------------+------------------+
|       1 |         0 |          1 |          1 | G         |       0 | 2         | Administrators |          1 | NULL         | NULL             |
+---------+-----------+------------+------------+-----------+---------+-----------+----------------+------------+--------------+------------------+
1 row in set (0.000 sec)

SELECT * FROM authorization_rule;
+---------+---------+----------------------+------------+------------+
| rule_id | role_id | resource_id          | privileges | permission |
+---------+---------+----------------------+------------+------------+
|       1 |       1 | Magento_Backend::all | NULL       | allow      |
+---------+---------+----------------------+------------+------------+
1 row in set (0.000 sec)

Delete recently created admin user

If you had created an admin user, then delete that user from the admin_user table and create the user again.


SELECT * FROM admin_user WHERE email = 'your.user@example.com';

DELETE FROM admin_user WHERE user_id = YOUR_USER_ID;

After that, you should be able to log in to the Magento admin panel.

Hope this helps. Thanks.

Related posts:

  1. Magento2: Reset Admin 2FA (Two-Factor Authentication)
  2. Magento 2: Run Custom SQL Query
  3. Magento: How to get admin user id, name, username, email, etc?
  4. Magento 2: Install via Composer and Command Line (CLI)
Categories Magento, Magento 2 Tags admin, login, Magento, magento2
Generate new Distribution Certificate for iOS/Apple App
Magento 2: Increase Admin Login Session Lifetime

About

Mukesh Chapagain Hi, I’m Mukesh Chapagain — a web developer, programmer, and tech enthusiast. Whether you're a beginner or an experienced developer, you’ll find tips, tutorials, and insights to help you navigate the ever-evolving world of technology. Happy coding! 🚀 about...

         

Subscribe via Email



Categories

Most Viewed

  • Very Simple Add, Edit, Delete, View (CRUD) in PHP & MySQL [Beginner Tutorial] - 435,143 views
  • How to Calculate Inverter & Battery Backup Time? - 430,453 views
  • LaTeX: Generate dummy text (lorem ipsum) in your document - 238,158 views
  • GPG: Remove keys from your public keyring? - 203,599 views
  • Magento: How to get attribute name and value? - 189,658 views

Recent Posts

  • Magento: The store that was requested wasn’t found. Verify the store and try again.
  • Magento2: Check Services version on Adobe Cloud Server
  • Magento 2 API: Add Products to Cart & Checkout Place Order
  • Magento 2 API: Create New Customer
  • Magento 2 API: Get Categories

Recent Posts

  • Magento: The store that was requested wasn’t found. Verify the store and try again.
  • Magento2: Check Services version on Adobe Cloud Server
  • Magento 2 API: Add Products to Cart & Checkout Place Order
  • Magento 2 API: Create New Customer
  • Magento 2 API: Get Categories

Most Viewed

  • Very Simple Add, Edit, Delete, View (CRUD) in PHP & MySQL [Beginner Tutorial] - 435,143 views
  • How to Calculate Inverter & Battery Backup Time? - 430,453 views
  • LaTeX: Generate dummy text (lorem ipsum) in your document - 238,158 views
  • GPG: Remove keys from your public keyring? - 203,599 views
  • Magento: How to get attribute name and value? - 189,658 views

Tag Cloud

admin Adobe Commerce api array attribute block category checkout CLI command line crud currency customer Database error extension git Google grid HTML image Javascript Joomla jQuery latex Linux login Magento magento2 magento 2 module MySQL natural language processing NLP nltk nodejs order PHP product python shopping cart template Ubuntu url Wordpress
© 2026 Mukesh Chapagain Blog
Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
View preferences
  • {title}
  • {title}
  • {title}