Magento 2 installation: Access denied for user root@localhost

If you get the following error during magento 2 installation:
Access denied for user root@localhost

magento2$ php bin/magento setup:install
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)
User Name is a required field.
First Name is a required field.
Last Name is a required field.
Please enter a valid email.
Password is required field.
Your password must be at least 7 characters.
Your password must include both numeric and alphabetic characters.

You should specify database connection settings:

php magento2/bin/magento setup:install --base-url=http://magento2.loc/ \
--db-host=localhost --db-name=mage2 --db-user=mage --db-password=pass \
--admin-firstname=name --admin-lastname=last --admin-email=us@email.com \
--admin-user=adminUser --admin-password=adminPass --language=en_US \
--currency=USD --timezone=America/Los_Angeles --use-rewrites=1

1 thought on “Magento 2 installation: Access denied for user root@localhost

  1. Pingback: Access denied for user root@localhost во время установки Magento 2 - Технарь

Leave a Reply

Your email address will not be published.