Comments - Cannot reset password for the root user in MariaDB (Mac keeps changing it on restart)

9 months, 2 weeks ago Victor Costa

Ok, let me answer your questions:

1. provide the version you're using

```sh
$ mariadb --version
mariadb from 11.4.2-MariaDB, client 15.2 for osx10.19 (arm64) using  EditLine wrapper
```

2. when you first install and have access, the contents of the global_priv table:

```sh
$ sudo mysql -uroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 11.4.2-MariaDB Homebrew

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SELECT CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)) FROM mysql.global_priv;
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv))                                                                                                                                                                                                     |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| mariadb.sys@localhost => {
    "access": 0,
    "plugin": "mysql_native_password",
    "authentication_string": "",
    "account_locked": true,
    "password_last_changed": 0
}                                                                         |
| root@localhost => {
    "access": 18446744073709551615,
    "plugin": "mysql_native_password",
    "authentication_string": "invalid",
    "auth_or": 
    [
        {
        },
        {
            "plugin": "unix_socket"
        }
    ]
}        |
| victorcosta@localhost => {
    "access": 18446744073709551615,
    "plugin": "mysql_native_password",
    "authentication_string": "invalid",
    "auth_or": 
    [
        {
        },
        {
            "plugin": "unix_socket"
        }
    ]
} |
| PUBLIC@ => {
    "access": 0,
    "is_role": true
}                                                                                                                                                                                                      |
| @localhost => {
}                                                                                                                                                                                                                                        |
| @victors-macbook-pro.local => {
}                                                                                                                                                                                                                        |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
6 rows in set (0.002 sec)
```

3. Also, let me show here the list of the users and the local passwords, because some of these passwords are `invalid`, which is weird.

```sh
MariaDB [mysql]> select Host, User, Password from user;
+---------------------------+-------------+----------+
| Host                      | User        | Password |
+---------------------------+-------------+----------+
| localhost                 | mariadb.sys |          |
| localhost                 | root        | invalid  |
| localhost                 | victorcosta | invalid  |
|                           | PUBLIC      |          |
| localhost                 |             |          |
| victors-macbook-pro.local |             |          |
+---------------------------+-------------+----------+
6 rows in set (0.001 sec)
```
 
9 months, 2 weeks ago Ian Gilfillan

I formatted your output for you :)

"Invalid" as a password means that password authentication is disabled. See Authentication from MariaDB 10.4.

"some users may wish to log in as MariaDB root without using sudo. Hence the old authentication method — conventional MariaDB password — is still available. By default it is disabled (“invalid” is not a valid password hash), but one can set the password with a usual SET PASSWORD statement."

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.