Changing database password in configuration.php
Moderators: Bernard T, mandville, fcoulter, General Support Moderators, Bernard T, fcoulter, mandville, General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant / FPA - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant / FPA - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
-
- Joomla! Intern
- Posts: 63
- Joined: Fri Sep 25, 2009 10:59 pm
Changing database password in configuration.php
My sites were hacked and I had them cleaned by a security service. The security service advised me to change all passwords including my database passwords, which I did in phpMyAdmin. My account has been reactivated.
Now I'm having trouble updating the database passwords in Joomla. There doesn't seem to be any $password for the database. They all look like...
public $db = 'mydatabase';
public $dbprefix = 'xxx_';
public $dbtype = 'mysql';
The error messages are simply "could not connect to MySql"
Where exactly do I update the password in the configuration.php file?
Now I'm having trouble updating the database passwords in Joomla. There doesn't seem to be any $password for the database. They all look like...
public $db = 'mydatabase';
public $dbprefix = 'xxx_';
public $dbtype = 'mysql';
The error messages are simply "could not connect to MySql"
Where exactly do I update the password in the configuration.php file?
-
- Joomla! Ace
- Posts: 1841
- Joined: Fri Jul 05, 2013 10:35 am
- Location: Parts Unknown
Re: Changing database password in configuration.php
Try adding it, if it doesn't exist.
- Per Yngve Berg
- Joomla! Master
- Posts: 27547
- Joined: Mon Oct 27, 2008 9:27 pm
- Location: Romerike, Norway
Re: Changing database password in configuration.php
There is a
public $password
at near the end of the file.
public $password
at near the end of the file.
-
- Joomla! Intern
- Posts: 63
- Joined: Fri Sep 25, 2009 10:59 pm
Re: Changing database password in configuration.php
Thank you, I tried but it made no difference.
-
- Joomla! Intern
- Posts: 63
- Joined: Fri Sep 25, 2009 10:59 pm
Re: Changing database password in configuration.php
The public $password relates to the Admin login.
-
- Joomla! Virtuoso
- Posts: 4213
- Joined: Tue Aug 23, 2005 1:56 pm
- Location: South coast, UK
- Contact:
Re: Changing database password in configuration.php
The $password needs to be the database password.
http://www.gadsolutions.biz Electrical services
http://www.electrical-testing-safety.co.uk Testing services
http://www.electrical-testing-safety.co.uk Testing services
- fcoulter
- Joomla! Ace
- Posts: 1685
- Joined: Thu Sep 13, 2007 11:39 am
- Location: UK
- Contact:
Re: Changing database password in configuration.php
No it does not. The administrator password is not stored anywhere except in encrypted form in the databaseThe public $password relates to the Admin login.
The database settings in the configuration.php should look something like this:-
Code: Select all
/* Database Settings */
public $dbtype = 'mysqli'; // Normally mysqli
public $host = 'localhost'; // This is normally set to localhost
public $user = ''; // DB username
public $password = ''; // DB password
public $db = ''; // DB database name
public $dbprefix = 'jos_'; //database prefix
If you are doing this by editing the configuration.php file, make sure that you change the file permissions to writable (0644) before doing so, otherwise the changes will not be saved. It is possible that this is why it is not working for you at the moment.
http://www.spiralscripts.co.uk for Joomla! extensions
http://www.fionacoulter.com/blog my personal website
Security Forum moderator :: VEL team member
"Wearing my tin foil hat with pride"
http://www.fionacoulter.com/blog my personal website
Security Forum moderator :: VEL team member
"Wearing my tin foil hat with pride"
-
- Joomla! Intern
- Posts: 63
- Joined: Fri Sep 25, 2009 10:59 pm
Re: Changing database password in configuration.php
Thank you fcoulter, changing permissions to 644 worked, and the database is now connected on one installation.
However when I change the permissions back to 444, the change doesn't take effect. Why would this be?
However when I change the permissions back to 444, the change doesn't take effect. Why would this be?
- fcoulter
- Joomla! Ace
- Posts: 1685
- Joined: Thu Sep 13, 2007 11:39 am
- Location: UK
- Contact:
Re: Changing database password in configuration.php
I am not sure what you mean. Do you mean that the permission doesn't change to 444? I don't know, it should do. It is possible that you just need to refresh the view in your ftp client.However when I change the permissions back to 444, the change doesn't take effect.
http://www.spiralscripts.co.uk for Joomla! extensions
http://www.fionacoulter.com/blog my personal website
Security Forum moderator :: VEL team member
"Wearing my tin foil hat with pride"
http://www.fionacoulter.com/blog my personal website
Security Forum moderator :: VEL team member
"Wearing my tin foil hat with pride"
- sozzled
- Joomla! Exemplar
- Posts: 9999
- Joined: Sun Jul 05, 2009 3:30 am
- Location: Canberra, Australia
Re: Changing database password in configuration.php
@fcoulter: the different behaviours may come about depending on who owns the files. For example, are the files owned by apache:apache? That may explain why 644 vs 444 operates differently. Just guessing, though.
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?”
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?”

- fcoulter
- Joomla! Ace
- Posts: 1685
- Joined: Thu Sep 13, 2007 11:39 am
- Location: UK
- Contact:
Re: Changing database password in configuration.php
When the permissions are 444 the file is not writeable by anyone so I don't think that the ownership matters.
I think it is pointless to keep guessing until the OP clarifies what they mean. We could be here all day.
I think it is pointless to keep guessing until the OP clarifies what they mean. We could be here all day.
http://www.spiralscripts.co.uk for Joomla! extensions
http://www.fionacoulter.com/blog my personal website
Security Forum moderator :: VEL team member
"Wearing my tin foil hat with pride"
http://www.fionacoulter.com/blog my personal website
Security Forum moderator :: VEL team member
"Wearing my tin foil hat with pride"
- sozzled
- Joomla! Exemplar
- Posts: 9999
- Joined: Sun Jul 05, 2009 3:30 am
- Location: Canberra, Australia
Re: Changing database password in configuration.php
... except the Global Configuration editor ...
Even so, we're speculating within a vacuum. I don't know what this means or why it would be the case:
... changing permissions to 644 worked, and the database is now connected on one installation. However when I change the permissions back to 444, the change doesn't take effect.
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?”
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?”

- Webdongle
- Joomla! Master
- Posts: 39469
- Joined: Sat Apr 05, 2008 9:58 pm
Re: Changing database password in configuration.php
Incorrect because saving the the global config does not write to the file. The Owner of a file that is 444 can delete it and then replace it (as well as change it the 444) but not edit it.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein.
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein.
- Webdongle
- Joomla! Master
- Posts: 39469
- Joined: Sat Apr 05, 2008 9:58 pm
Re: Changing database password in configuration.php
With configuration.php 444 the site doesn't work but with it 644 the site does?
If that is correct it would suggest that Joomla needed to edit the configuration.php every time it run and that it was not Owner. That would be a very unusual set of circumstances!
viewtopic.php?f=714&t=793531 please.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein.
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein.
- fcoulter
- Joomla! Ace
- Posts: 1685
- Joined: Thu Sep 13, 2007 11:39 am
- Location: UK
- Contact:
Re: Changing database password in configuration.php
The OP doesn't say that the site doesn't work, he or she says "the change doesn't take effect". I interpret that to mean that they just didn't understand that with 444 permissions the file is read-only.
In the absence of further information I suggest regarding this topic as closed.
In the absence of further information I suggest regarding this topic as closed.
http://www.spiralscripts.co.uk for Joomla! extensions
http://www.fionacoulter.com/blog my personal website
Security Forum moderator :: VEL team member
"Wearing my tin foil hat with pride"
http://www.fionacoulter.com/blog my personal website
Security Forum moderator :: VEL team member
"Wearing my tin foil hat with pride"