How to change default passwords for MySQL?

Discussion in 'General' started by mex, Nov 9, 2009.

  1. mex

    mex

    Joined:
    Nov 7, 2009
    Messages:
    8
    Likes Received:
    0
    Hello!
    Passwords are stored in what files by default for MySQL-server database access? How correctly to substitute them on new, not to do much harm to system?
    For earlier I thank!
     
  2. ramoncio

    Joined:
    May 12, 2010
    Messages:
    1,663
    Likes Received:
    0
    It is not easy to change the default mysql root password, as it is hardcoded in many config files, and if you do something wrong you might break your system. But this is not a security issue as root connections are limited to localhost.

    What you can do is to create a new user using your preferred password and even granting permissions to access from your lan or any machine. You can do it either from mysql cli or using a gui like webmin or phpmyadmin.
     
  3. mex

    mex

    Joined:
    Nov 7, 2009
    Messages:
    8
    Likes Received:
    0
    Thanks for the information! The matter is that I already did it, on fighting system, and I really had problems with operation, but as I needed to return all back (as was by default) I could not. It was necessary to complete that that the beginnings :) well it has turned out, but I cannot recollect as where I am is concrete changed... :( Thought that can help me... I Think that sense to change passwords by default in MySQL is not present.
     
  4. ramoncio

    Joined:
    May 12, 2010
    Messages:
    1,663
    Likes Received:
    0
    If you have lost access, by setting the wrong permissions, there was a way to recover it, I had to do it some time ago.
    The easiest way, if it works, is starting mysqld with skip-grant-tables option, and then changing the root password. And if that doesn't work, there was another way, using a init file and a command line option like 'mysqld --with-init-file=yourinitfile.txt' or something like that.
    You will have to Google it and read a little about mysql permissions, as I don't remember it very well, sorry.

    Good luck!
     

Share This Page