Shopware CLI: Access denied for User root@localhost

The problem occurs if the MySQL service cannot be addressed via the DNS name localhost. To increase performance, we activate the skip-name-resolve option in the standard MySQL configuration. As a result, the server can no longer be resolved via DNS name, but also does not perform name resolution per MySQL connection.

Error message

Access denied for 'root'@'localhost'

(When calling a CLI command)


In the .env or env.local file, the database server is addressed via localhost instead of Adjust the MySQL server host in the .env / .env.local to the value

The Shopware CLI can then be called via bin/console without any problems. If the error still occurs, the Shopware cache may need to be cleared.


MariaDB documentation (skip-name-resolve)