Tip: How to change a database password without downtime

Started by Jason, April 24, 2007, 03:06:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jason

I've received a few questions about this so I thought I'd post the process I use when I update database passwords.

This is the best way I've found to minimize any disruption to your database's functionality.  I do this using a brand new database user instead of editing the current one.  If you do it this way there's virtually no downtime to your site.


1.  I open cpanel and go into the mysql page where I can alter my database users.  I create a brand new user with a brand new password.  I assign that user to the database to give it privileges.

2.  I connect to my site via ftp and download a copy of whatever configuration/connection file I'll need to edit with the new information.  For example, for SMF, this is the file called Settings.php.

3.  I find the database user line in the configuration file above and type over it with the new one.  I also overwrite the database user password with the new.  I save that file on my local computer and then upload it back to the server overwriting the one that's presently there.

That's it.

At that point you can safely delete the old database user in cpanel as it's no longer needed (unless you were using the same database user for multiple databases in which case you'll want to update all of them before deleting).


Finner


Mishenka


Jason


akheir

Just a cautionary note:

Be careful that you are selecting the CORRECT delete button.

The one for DATABASE can be very close to the user delete button.

If you are tired or distracted, it is VERY EASY to delete the whole database!

I know that probably no-one is dumb enough to do this  :), but it is worth mentioning!
Plan
Promote
Profit

Kheir Consulting
http://www.kheirconsulting.com