skip to Main Content

When I SSH into my server I can access the MySQL stuff without using the password. So when I type.

mysql -u root -p

It’ll prompt me for a password but I can type anything and I get access to the MySQL environment.

So I’ve tried to change the root password using this but it doesn’t work.

mysqladmin -u root password NEW_PASSWORD
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.

I’ve also tried this…

use mysql;
update user set authentication_string=password('NEW_PASSWORD') where user='root';
​flush privileges;
​quit

That didn’t work.

And this…

use mysql;
UPDATE mysql.user SET authentication_string = PASSWORD('NEW_PASSWORD') WHERE User = 'root' AND Host = 'localhost';
flush privileges;
​quit

Which also didn’t work.

I’ve seen this tutorial https://www.techrepublic.com/article/how-to-set-change-and-recover-a-mysql-root-password/ but I don’t understand why I should hardcode my root password in a text file call ~/mysql-pwd and put that on my server. That just sounds crazy.

(Question 1) Is it actually secure to leave your password typed into a text file on your server?

I’m also using winmin to manage my server and this is doing something strange, which could be related to why I can’t set the root password.

My website has SSL certificates on it and they work. However when I access my webmin environment which is on port 10000, then firefox doesn’t recognise the SSL certificates and I have to add an exception into firefox so that I can see my webmin environment.

Firefox don’t have any problems with the phpMyAdmin using the SSL certificates.

(Question 2) So does this webmin issue mean that my SSL certificates are not setup properly and this is effecting when I SSH into the server?

2

Answers


  1. All you need to pass a parameter, --ssl-mode=required to make secure shell connection.
    I attached the screen-shot without/with ssl-modeenter image description here

    Login or Signup to reply.
  2. The following worked for me

    $sudo  ./mysqladmin -u root -p --ssl-mode=required password
    

    Then give details Enter password:
    New password:
    Confirm new password:

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search