Join the community today
Become a Member

MariaDB Accounts Without Passwords

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Jimmy, Apr 9, 2017.

  1. Jimmy

    Jimmy Premium Member Premium Member

    1,114
    247
    63
    Oct 24, 2015
    East Coast USA
    Ratings:
    +596
    Local Time:
    5:50 AM
    1.13.x
    MariaDB 10.1.x
    I was reading up on mysql accounts without passwords and came across what is below. I was just curious if this is something I have to change.

    Entering mysql as root. If I enter what is below, I'm not prompted for a password. Is this correct or do I need to assign a password? Or because I'm logged in as root I don't need to provide a password?
    Code:
    mysql -u root

    Checking Which Accounts Exist

    https://dev.mysql.com/doc/refman/5.7/en/default-privileges.html
    Code:
    mysql> SELECT User, Host, HEX(authentication_string) FROM mysql.user;
    Code:
    +------+--------------------+----------+
    | User | Host               | Password |
    +------+--------------------+----------+
    | root | localhost          |          |
    | root | myhost.example.com |          |
    | root | 127.0.0.1          |          |
    | root | ::1                |          |
    |      | localhost          |          |
    |      | myhost.example.com |          |
    +------+--------------------+----------+
    
    My server output via the mysql command above:
    Code:
    MariaDB [(none)]> SELECT User, Host, HEX(authentication_string) FROM mysql.user;
    
    +------+---------------------+----------------------------+
    | User | Host                | HEX(authentication_string) |
    +------+---------------------+----------------------------+
    | root | localhost           |                            |
    | root | server.server11.com |                            |
    | root | 127.0.0.1           |                            |
    | root | ::1                 |                            |
    +------+---------------------+----------------------------+
    
    Just curious if this is something that needs to be changed or not?
     
    Last edited: Apr 9, 2017
  2. eva2000

    eva2000 Administrator Staff Member

    30,178
    6,786
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,139
    Local Time:
    7:50 PM
    Nginx 1.13.x
    MariaDB 5.5
    Centmin Mod auto sets mysql root password just it also sets up /root/.my.cnf file with mysql root pass so you do no have to enter mysql root password on every command line mysql client run.

    re-read that link, you used command for MySQL 5.7+ not <5.7 where MariaDB 10.1 is based on MySQL 5.6 so need to use
    Code (Text):
    mysql -e "SELECT User, Host, Password FROM mysql.user;"
    

    MariaDB 10.2 will be based on MySQL 5.7 so use the other command
     
    • Like Like x 1
  3. Jimmy

    Jimmy Premium Member Premium Member

    1,114
    247
    63
    Oct 24, 2015
    East Coast USA
    Ratings:
    +596
    Local Time:
    5:50 AM
    1.13.x
    MariaDB 10.1.x
    Bingo. That's it. Passwords are populated for all the entries.
     
    • Like Like x 1