I have set up LAMP stack in my local Ubuntu 18.04 laptop. MariaDB root password is working fine.
I have setup nextcloud in my localhost. Non root user password is working fine. But I have forgot root login password.
How to reset it.
Nextcloud has a document for that (https://docs.nextcloud.com/server/9/admin_manual/configuration_user/reset_admin_password.html). What happened when you tried that?
From the documentation:
That is using the occ command. occ is in the nextcloud directory, for example /var/www/nextcloud/occ. occ has a command for resetting all user passwords, user:resetpassword. It is best to run occ as the HTTP user, as in this example on Ubuntu Linux:
$ sudo -u www-data php /var/www/nextcloud/occ user:resetpassword admin
Enter a new password:
Confirm the new password:
Successfully reset password for admin
If your Nextcloud username is not admin, then substitute your Nextcloud username.
If you are using docker, use the following (note: requires 10 characters for the new password)
$ docker exec -it -u www-data <<containername>> php /var/www/html/occ user:resetpassword admin