Change Database user password? Topic is solved

Discussion regarding Joomla! 4.x security issues.

Moderators: 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.
Locked
Peakoverload
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 133
Joined: Thu Feb 16, 2006 10:07 pm

Change Database user password?

Post by Peakoverload » Wed Oct 12, 2022 3:59 pm

I want to change the password for the main user of the Joomla database but not sure of the best way to do this.

I tried changing the password in MYSQL and then edited the global config with the new password (I was already logged in before I changed it) but it didn't work and said it couldn't connect. I presume this was because it couldn't save the new password to the database as the password had changed. I changed the password back in MYSQL and the site came back up.

So what is the best way to do this?

User avatar
mjparadac
Joomla! Hero
Joomla! Hero
Posts: 2488
Joined: Mon Oct 29, 2012 3:58 pm

Re: Change Database user password?

Post by mjparadac » Wed Oct 12, 2022 4:35 pm

Hello Peakoverload

This thread could explain that situation
viewtopic.php?t=964601

Hope this helps.

Regards,
Joomla Community Ambassador for A2 Hosting | A2 Hosting - Our speed, your success | https://www.a2hosting.com/joomla-hosting

User avatar
ceford
Joomla! Hero
Joomla! Hero
Posts: 2677
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: Change Database user password?

Post by ceford » Wed Oct 12, 2022 5:07 pm

You need to change the password for the joomla user in the database. In phpMyAdmin you go to User Accounts, edit the User and look for the Password tab.

Then you set the username and new password in configuration.php.

sozzled
I've been banned!
Posts: 13639
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Change Database user password?

Post by sozzled » Wed Oct 12, 2022 5:49 pm

@ceford: I don't think that's what @Peakoverload is asking. I think we're discussing how to change the SQL username and/or password that connects the file system to the database. From the J! side, this is done by changing the global configuration settings; from the database side, the DB user needs to be assigned to the database with ALL PRIVS.

I'm not sure if one or other of those parts has been done.

Peakoverload
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 133
Joined: Thu Feb 16, 2006 10:07 pm

Re: Change Database user password?

Post by Peakoverload » Wed Oct 12, 2022 8:48 pm

Just to clarify as I probably didn't explain it very clearly.

Currently my joomla SQL database has one user and that user has a password. It is this password I want to change.

It sounds to me that what Ceford posted is the solution I'm after. However, I changed the password and then edited my configuration file with the new password and it didn't work with the site saying that it couldn't connect to the database. I changed both back to the original password and it all worked again????

The only thing I did slightly different is that I didn't use phpMyAdmin. My host, Siteground, provides Site Tools which is what I originally used to create the database and user and so I'm just using that same tool to change the user password. Also I'm using Sitegrounds File Manager to edit the configuration.php file, rather than download it, edit and re-upload but I can't see how that would make any difference.

sozzled
I've been banned!
Posts: 13639
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Change Database user password?

Post by sozzled » Wed Oct 12, 2022 8:51 pm

If the SQL database has one user and you want to change the password for that user then you need to use a tool provided by your webhosting provider. I don't know what tools Sitegrounds has for managing database user passwords, sorry.

Peakoverload
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 133
Joined: Thu Feb 16, 2006 10:07 pm

Re: Change Database user password?

Post by Peakoverload » Wed Oct 12, 2022 9:02 pm

Ahh I've found the problem. The instructions from Cerford are correct (thank you). Unfortunately for some reason I cannot save any changes to the configuration file. I've tried editing them in File Manager, I've tried downloading it, editing and uploading but each time I try to overwrite the existing file, it fails to do it??? Ahh, I wonder if it's RSFirewall that's blocking it?

EDIT: No, it wasn't RSFirewall

sozzled
I've been banned!
Posts: 13639
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Change Database user password?

Post by sozzled » Wed Oct 12, 2022 9:08 pm

OK, easy one (I think).

The file configuration.php is read-only (i.e. the file permissions are set to 444) which means you can't edit the file with your host-provided File Manager tool unless you change the permissions to 644. Then you can edit the file, make your changes and save them. After doing that, change the file permissions back to 444.

Peakoverload
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 133
Joined: Thu Feb 16, 2006 10:07 pm

Re: Change Database user password?

Post by Peakoverload » Wed Oct 12, 2022 9:10 pm

Bingo that was it! Cheers for that and thanks again to everyone else. Much appreciated.


Locked

Return to “Security in Joomla! 4.x”