Magento 2如何通过命令行添加管理员用户

在本教程中,我们将讨论如何通过命令行添加管理员用户命令行系列。如您所知,在Magento 2中,它们在中添加了许多命令bin/magento。这可能很难解决,让我解释一下如何通过命令行添加管理员用户的更多细节。

如何通过命令行添加管理员用户

转到Magento管理员根文件夹并显示用法:

php bin/magento admin:user:create --help

输出:

Usage:
  admin:user:create [options]

Options:
      --admin-user=ADMIN-USER                    (Required) Admin user
      --admin-password=ADMIN-PASSWORD            (Required) Admin password
      --admin-email=ADMIN-EMAIL                  (Required) Admin email
      --admin-firstname=ADMIN-FIRSTNAME          (Required) Admin first name
      --admin-lastname=ADMIN-LASTNAME            (Required) Admin last name
      --magento-init-params=MAGENTO-INIT-PARAMS  Add to any command to customize Magento initialization parameters
                                                 For example: "MAGE_MODE=developer&MAGE_DIRS[base][path]=/var/www/example.com&MAGE_DIRS[cache][path]=/var/tmp/cache"
  -h, --help                                     Display this help message
  -q, --quiet                                    Do not output any message
  -V, --version                                  Display this application version
      --ansi                                     Force ANSI output
      --no-ansi                                  Disable ANSI output
  -n, --no-interaction                           Do not ask any interactive question
  -v|vv|vvv, --verbose                           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
  Creates an administrator

让我们用以下信息创建一个管理员帐户:

  • 用户:mageplaza
  • 密码:WeLoveMagento
  • 电子邮件:hi@mageplaza.com
  • 名:玛格广场
  • 姓氏:家庭

所以我们的命令行是:

php bin/magento admin:user:create --admin-user=mageplaza --admin-password=WeLoveMagento --admin-email=hi@mageplaza.com --admin-firstname=Mageplaza --admin-lastname=Family

它显示一个错误:Your password must include both numeric and alphabetic characters. 密码应该更复杂。

  • 密码:WeLoveMagento123
php bin/magento admin:user:create --admin-user=mageplaza --admin-password=WeLoveMagento123 --admin-email=hi@mageplaza.com --admin-firstname=Mageplaza --admin-lastname=Family

我成功创建了一个新的管理员帐户,它返回以下消息:

Created Magento administrator user named mageplaza

现在进入管理员登录页面,并填写以上信息

我现在在,请看此屏幕截图

相关文章

0 0 投票数
文章评分
订阅评论
提醒
0 评论
内联反馈
查看所有评论