4

I want to find out where does Magento2 keeps it's admin path in the database?

Any suggestions will be appreciated.

7

I don't think Magento 2 admin path is stored in the database.

You can find the randomly generated path in the app/etc/env.php file, e.g.:

'backend' => 
array (
  'frontName' => 'admin_1ai8c5',
)

Also an easy way to retrieve the admin path is by using the following Magento 2 CLI:

php bin/magento info:adminuri
1

you can find base_url & many core cofig detail in core_config_data table (if you really want to the table).

& if you want to change admin URL always prefer CLI as below command:

bin/magento setup:config:set --backend-frontname=admin

0

In Case You Cannot Access The Admin

If like me you could not access the admin, you will need to add a core_config_data configuration with the path:

INSERT INTO `core_config_data`(`scope`, `scope_id`, `path`, `value`)
VALUES(
    'default', # Or whatever your Scope is
    0,         # Or whatever your Scope ID is
    'admin/url/use_custom',
    1
);
INSERT INTO `core_config_data`(`scope`, `scope_id`, `path`, `value`)
VALUES(
    'default', # Or whatever your Scope is
    0,         # Or whatever your Scope ID is
    'admin/url/custom',
    'https://my.url.com/newadminpath/'
);

Then run the CLI command:

php bin/magento setup:config:set --backend-frontname="newadminpath"
php bin/magento maintenance:enable 
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento maintenance:disable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.