#Unable to Regenerate MySQL DB password

28 messages · Page 1 of 1 (latest)

sly ivy
#

I have tried multiple times to regenerate the MySQL DB password via Database -> Config -> Regenerate Password. Once triggered, the database redeploys and the environment variables update in the Railway console, however when connecting to the DB, the new password does not work and the original one still works.

We need this fixed ASAP.

Thanks in advance.

crimson raptorBOT
fresh marten
#

Try this:

  1. SSH into your MySQL service (Right click the service and Copy SSH Command) (You'll need Railway CLI installed for this to work)
  2. In the terminal, paste the SSH command and run mysql -u root -p
  3. Enter the current working password
  4. Run the following commands:
ALTER USER 'root'@'localhost' IDENTIFIED BY '<PASSWORD>';
FLUSH PRIVILEGES;

Where <PASSWORD> is replaced with the new password (From the variable MYSQL_ROOT_PASSWORD

#

This should reset the MySQL's password to use the newly generated password in the variables tab.

sly ivy
#

Thanks - let me give this a try

#

@fresh marten very odd.. so when running mysql -u root -p, it only acepts the new password, but when connecting externally, this password doesn't work and I can only use the original password

fresh marten
#

Is this correct?

sly ivy
#

All correct apart from bottom - railway's database UI connects fine

fresh marten
#
  • External connection requires old password
  • Root access via SSH uses new password
  • Current Railway variable is new password
  • Railway's database UI does connect
    -# Oops accidentally deleted old msg
sly ivy
#

Correct

#

I ran the alter user command just now, didn't expect anything to change, and I was correct

#

So it seems the proxy has its own auth system maybe, once its happy with the password received externally it just tunnels the connection thru Railway?

#

That seems like the only logical explanation to the password mismatch

#

@smoky heron any thoughts?

smoky heron
#

No need to ping, pepper is handling this.

sly ivy
#

you reacted

fresh marten
sly ivy
#

@fresh marten thanks, but this made no difference also

fresh marten
#

Sorry, but just to clarify, you ran ALTER USER 'root'@'%' IDENTIFIED BY '<PASSWORD>';, yes? Where <PASSWORD> has the new password.

sly ivy
#

yes that's correct

#

and also flushed

#

@fresh marten nevermind, working now!

fresh marten
#

Good to know.

sly ivy
#

I had to fully disconnect my client to re-trigger auth

#

Looks good now, thanks very much for the help

fresh marten
#

Almost scared me haha, spun up a test MySQL instance just to test the ALTER commands and it was working on my end.

#

No worries.

crimson raptorBOT
#

New reply sent from Central Station thread:

This thread has been marked as solved. Please create a new thread if you need further assistance.

You're seeing this because this thread has been automatically linked to the Central Station thread.