Changing database password in configuration.php

Discussion regarding Joomla! 3.x security issues.

Moderators: Bernard T, mandville, fcoulter, 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.
Locked
Shelomit
Joomla! Intern
Joomla! Intern
Posts: 58
Joined: Fri Sep 25, 2009 10:59 pm

Changing database password in configuration.php

Post by Shelomit » Tue Aug 14, 2018 5:31 am

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?

 
SharkyKZ
Joomla! Ace
Joomla! Ace
Posts: 1759
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: Changing database password in configuration.php

Post by SharkyKZ » Tue Aug 14, 2018 5:34 am

Try adding it, if it doesn't exist.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 26996
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: Changing database password in configuration.php

Post by Per Yngve Berg » Tue Aug 14, 2018 7:03 am

There is a

public $password

at near the end of the file.

Shelomit
Joomla! Intern
Joomla! Intern
Posts: 58
Joined: Fri Sep 25, 2009 10:59 pm

Re: Changing database password in configuration.php

Post by Shelomit » Tue Aug 14, 2018 7:13 am

Thank you, I tried but it made no difference.

Shelomit
Joomla! Intern
Joomla! Intern
Posts: 58
Joined: Fri Sep 25, 2009 10:59 pm

Re: Changing database password in configuration.php

Post by Shelomit » Tue Aug 14, 2018 9:42 am

The public $password relates to the Admin login.

gws
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4138
Joined: Tue Aug 23, 2005 1:56 pm
Location: South coast, UK
Contact:

Re: Changing database password in configuration.php

Post by gws » Tue Aug 14, 2018 9:45 am

The $password needs to be the database password.

User avatar
fcoulter
Joomla! Ace
Joomla! Ace
Posts: 1685
Joined: Thu Sep 13, 2007 11:39 am
Location: UK
Contact:

Re: Changing database password in configuration.php

Post by fcoulter » Tue Aug 14, 2018 9:52 am

The public $password relates to the Admin login.
No it does not. The administrator password is not stored anywhere except in encrypted form in the database

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

Make sure that all these are set to the correct values for your site.

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"

Shelomit
Joomla! Intern
Joomla! Intern
Posts: 58
Joined: Fri Sep 25, 2009 10:59 pm

Re: Changing database password in configuration.php

Post by Shelomit » Tue Aug 14, 2018 7:48 pm

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?

User avatar
fcoulter
Joomla! Ace
Joomla! Ace
Posts: 1685
Joined: Thu Sep 13, 2007 11:39 am
Location: UK
Contact:

Re: Changing database password in configuration.php

Post by fcoulter » Wed Aug 15, 2018 9:57 am

However when I change the permissions back to 444, the change doesn't take effect.
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.
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"

User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 9280
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Changing database password in configuration.php

Post by sozzled » Wed Aug 15, 2018 10:00 am

@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?” :)

User avatar
fcoulter
Joomla! Ace
Joomla! Ace
Posts: 1685
Joined: Thu Sep 13, 2007 11:39 am
Location: UK
Contact:

Re: Changing database password in configuration.php

Post by fcoulter » Wed Aug 15, 2018 10:07 am

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.
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"

User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 9280
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Changing database password in configuration.php

Post by sozzled » Wed Aug 15, 2018 10:19 am

fcoulter wrote:
Wed Aug 15, 2018 10:07 am
When the permissions are 444 the file is not writeable by anyone ..
... 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?” :)

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 38765
Joined: Sat Apr 05, 2008 9:58 pm

Re: Changing database password in configuration.php

Post by Webdongle » Thu Aug 16, 2018 10:08 am

sozzled wrote:
Wed Aug 15, 2018 10:19 am
fcoulter wrote:
Wed Aug 15, 2018 10:07 am
When the permissions are 444 the file is not writeable by anyone ..
... except the Global Configuration editor ....
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.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 38765
Joined: Sat Apr 05, 2008 9:58 pm

Re: Changing database password in configuration.php

Post by Webdongle » Thu Aug 16, 2018 10:14 am

Shelomit wrote:
Tue Aug 14, 2018 7:48 pm
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?
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.

User avatar
fcoulter
Joomla! Ace
Joomla! Ace
Posts: 1685
Joined: Thu Sep 13, 2007 11:39 am
Location: UK
Contact:

Re: Changing database password in configuration.php

Post by fcoulter » Thu Aug 16, 2018 10:34 am

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.
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"

 

Locked

Return to “Security in Joomla! 3.x”