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

  • How to Calculate Inverter & Battery Backup Time? - 428,020 views
  • Very Simple Add, Edit, Delete, View (CRUD) in PHP & MySQL [Beginner Tutorial] - 415,646 views
  • LaTeX: Generate dummy text (lorem ipsum) in your document - 228,046 views
  • GPG: Remove keys from your public keyring? - 201,573 views
  • Magento: How to get attribute name and value? - 188,264 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

  • How to Calculate Inverter & Battery Backup Time? - 428,020 views
  • Very Simple Add, Edit, Delete, View (CRUD) in PHP & MySQL [Beginner Tutorial] - 415,646 views
  • LaTeX: Generate dummy text (lorem ipsum) in your document - 228,046 views
  • GPG: Remove keys from your public keyring? - 201,573 views
  • Magento: How to get attribute name and value? - 188,264 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
© 2025 Mukesh Chapagain Blog
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkPrivacy policy