Want to use preexisting database for elgg 1.8 in another machine.

I have to set up elgg project on local in another machine and i have the elgg folder and database file and now i want to install elgg using existing database but i couldn't able do it either changing the settings.php file or defining the db name that exist previously.

So how i can use that db with installation. please guide me.