This only works, if you are running Portainer as a container.
First of all, stop your Portainer container. Just replace "id-of-container" with whatever your container id is. To find that out, just type in docker ps and copy the ID of the Portainer container.
docker stop "id-of-container"
Next, pull the password reset helper and mount the Portainer data volume to it. Replace "portainer-data" with the directory where your Portainer data is stored.
docker pull portainer/helper-reset-password
docker run --rm -v "portainer-data":/data portainer/helper-reset-password
The output of the last command should look something like this:
2020/06/04 00:13:58 Password successfully updated for user: admin
2020/06/04 00:13:58 Use the following password to login: <your-new-password>
You can now use your new password to access Portainer again.