From what you say you seem to have 'sa' access to your database server. Can you check the following:
1) $g_hostname = 'localhost' implies that the database server is running on the same host as your webserver. Is this correct?
2) If you haven't already removed the 'admin' directory, try running '<mantisURL>/admin/check.php' from your browser and see if that reports any problems. Check particularly that the 'mantis' database user has all the required privileges to access the database (SELECT,INSERT,UPDATE,DELETE) from the webserver host.
3) What web server are you using, Apache, IIS or another? User access rights may be a problem although if you've completed the installation process then that seems unlikely. Did you run the install locally or from a remote machine via the web i.e. were you logged on to the mantis host at the time?