as experience shows, you just make sure your env.php
file is writeable.
restore or create new password for database user, from phpmyadmin or mysql shell,
for example it will look like this:
mysql$> select user,host from mysql.user;
+-----------------+-----------+
| user | host |
+-----------------+-----------+
| magento | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+-----------------+-----------+
4 rows in set (0.00 sec)
change password for example user magento
mysql$> ALTER USER 'magento'@'localhost' IDENTIFIED BY 'New-Password-Here';
backup all your files and db.
remove all caches:
rm -rf var/cache/* generated/* var/view_preprocessed/*
open your website, you will be redirected to /setup/
, enter all your required information for re-install.
make sure there is NO any checkboxes selected to wipe database data.
after final install button, your config will be re-stored/re-created.
you will be able to access your shop.