You must know the mysql root password in order to set/reset the admin password, here is the query you should use:
mysql -u root -p qstats -e "UPDATE users SET password=sha1('newpassword') WHERE login='admin'";
That will set "admin" password to "newpassword"
If the above does not work, then consider another issue that you might be having (if the above does not work), is that the php session directory is no writable by the web server user/process. This is something that might occur if you upgrade PHP to a newer version when using Elastix/FreePBX. In order to restore sessions, you will have to change ownership of the session directory for the "asterisk" user, with this command:
chown asterisk.asterisk /var/lib/php/sessions