We're going to delete some files, so back them up first if you want a copy for later reference.
sudo rm -f LocalSettings.php
sudo rm -f config/LocalSettings.php
Now open your wiki in a browser. It will walk you through initial setup again.
The default installation directory in Ubuntu server is /usr/local/mediawiki, softlinked from /var/www/mediawiki. If you have copied the directory elsewhere, just use that path instead in the following example. Depending on your user privileges, you may want to log in as root or sudo all of the following commands.
You should see a LocalSettings.php file. This is a real file or a symlink to /etc/mediawiki/LocalSettings.php, which you can delete instead if you prefer. If you are using multiple wikis, though, it is helpful to replace all of these symlinks with local copies.
rm -f LocalSettings.php
you should also see a config directory. If you don't you can create one thus:
ln -s /var/lib/mediawiki/config ./config
Now you can remove the generated config file (which doesn't actually get used, just copied to the proper location)
rm -f config/LocalSettings.php
Now if you hop over to your wiki in a browser, you will be prompted to go through initial setup again. This will generate the config/LocalSettings.php file again, allowing you to copy it to your install dir.
cp config/LocalSettings.php ./
Under Ubuntu, I changed the permissions and the user to my web server user for security:
chmod 700 LocalSettings.php
chown www-data LocalSettings.php