Find the answer to your Linux question:
Results 1 to 2 of 2
I have a question from the directions at the link below regarding setting up the root users password for the mysql server at time of first installation. How to Install ...
  1. #1
    Linux Newbie
    Join Date
    Feb 2007
    Location
    USA
    Posts
    221

    Setting MySQL Root Password

    I have a question from the directions at the link below regarding setting up the root users password for the mysql server at time of first installation.

    How to Install MySQL 5.0 on Linux - MySQL 5.0 installation

    **************EXCERPT FROM LINK ABOVE***********************
    set the root password

    Now, before you do anything else, set root user's password (!). Stay connected to MySQL and enter:
    DELETE FROM mysql.user WHERE User = '';
    FLUSH PRIVILEGES;
    SELECT Host, User FROM mysql.user;

    Look for the record that has root in the User column and something other than localhost in the Host column. This is the host_name.
    SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');
    SET PASSWORD FOR 'root'@'host_name' = PASSWORD('new_password');

    ************************************************** ********
    On OpenSUSE 11.1, I have 3 hosts. "127.0.0.1" is not mentioned in the directions from above.
    +------------+------+
    | Host | User |
    +------------+------+
    | 127.0.0.1 | root |
    | linux-20k5 | root |
    | localhost | root |
    +------------+------+

    Is the proper setup for the root password on a mysql server to change the root password for just the host name ("linux-20k5") or for all the hosts ( "localhost," "linux-20k5," and "127.0.0.1")?

    Thanks.

    -Mike
    Suse Linux Enterprise Server 11
    Suse Linux Enterprise Server 10 - SP3
    OpenSuse 11.2, KDE 4.3.1

  2. #2
    Linux Guru waterhead's Avatar
    Join Date
    Jul 2004
    Location
    Franklin, Wisconsin
    Posts
    4,577
    The MySQL root password would be for only that particular MySQL server. It should cover all MySQL databases on that server.

    I use this command to set the root password. Replace ROOT_PWD with the real root password, inside of the single quotes. This is assuming that you are not already logged into the server, and run this command with root privileges (su or sudo).
    Code:
    # mysql -u root mysql
    mysql> UPDATE user SET Password=PASSWORD('ROOT_PWD') WHERE user='root';
    mysql> FLUSH PRIVILEGES;
    mysql> quit
    On Fedora, I had problems doing this and had to perform a few extra steps. See if this works on Suse without any problems.
    Paul

    Please do not send Private Messages to me with requests for help. I will not reply.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...