1

Topic: No root password for Mysql?

======== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.3
- Linux/BSD distribution name and version: Ubuntu 15.10
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): Mysql
- Web server (Apache or Nginx): nginx
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue:
====

Brand new install of iRedMail 0.9.3.  It seems that a password is not set for mysqlroot user:

# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 550
Server version: 10.0.22-MariaDB-0ubuntu0.15.10.1 (Ubuntu)

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

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

MariaDB [(none)]>

You can see it here too:

MariaDB [(none)]> select user,host,password from mysql.user;
+------------+-----------+-------------------------------------------+
| user       | host      | password                                  |
+------------+-----------+-------------------------------------------+
| root       | localhost | *213E66B6DA9D8EA4C2489A99F8B553C3C4C3B0ED |
| root       | mail2     |                                           |
| root       | 127.0.0.1 |                                           |
| root       | ::1       |                                           |
| vmail      | localhost | *DA355D720818031B807A8D6988AE36E731032055 |
| vmailadmin | localhost | *B5E718687641DDE4222F7A80FA57A5C09154D248 |
| amavisd    | localhost | *C26BE4A684EF6E4D6536C84A0DEE314D0EF28D46 |
| iredapd    | localhost | *ACD6F0DB03658F49F8ABFA12C76726A3BA8F3B78 |
| iredadmin  | localhost | *7A2ACA767A7326260B66CF66FBEAA6EA8F4B0427 |
| roundcube  | localhost | *202B338653A91F3CB4144E9F7D0546AC407C3DE4 |
+------------+-----------+-------------------------------------------+
10 rows in set (0.00 sec)

Am I crazy?  Did something go wrong on the install?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: No root password for Mysql?

Whoa, even when I set a password I can get in without one:

MariaDB [vmail]> select user,host,password from mysql.user;
+------------+-----------+-------------------------------------------+
| user       | host      | password                                  |
+------------+-----------+-------------------------------------------+
| root       | localhost | *213E66B6DA9D8EA4C2489A99F8B553C3C4C3B0ED |
| root       | mail2     | *213E66B6DA9D8EA4C2489A99F8B553C3C4C3B0ED |
| root       | 127.0.0.1 | *213E66B6DA9D8EA4C2489A99F8B553C3C4C3B0ED |
| root       | ::1       | *213E66B6DA9D8EA4C2489A99F8B553C3C4C3B0ED |

Password is set, but:

# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 43
Server version: 10.0.22-MariaDB-0ubuntu0.15.10.1 (Ubuntu)

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

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

MariaDB [(none)]>

And yes, I did "flush privileges', and no, there is no ".my.cnf".

This could be bad...

3 (edited by tsouica 2016-01-19 14:43:00)

Re: No root password for Mysql?

Hi,

I just installed 0.9.3 on a Debian and I don't have this issue. Are you sure you filled in a password for root account during install ?

4

Re: No root password for Mysql?

Weird. With iRedMail-0.9.3, iRedMail will generate (and set) a random and strong password for mysql root user automatically. Not sure why it doesn't work on your server, I need to try to reproduce this issue on my testing machine.

By the way, do you have a password in file "config" under iRedMail-0.9.3 directory?

5

Re: No root password for Mysql?

tsouica wrote:

I just installed 0.9.3 on a Debian and I don't have this issue. Are you sure you filled in a password for root account during install ?

0.9.3 doesn't ask for a password on a fresh install.  It generates one randomly.

6

Re: No root password for Mysql?

I cannot reproduce this issue on my testing machine. Could you please show us FULL content of file iRedMail-0.9.3/runtime/install.log? Maybe there's something wrong when iRedMail tried to reset MYSQL root password.

7

Re: No root password for Mysql?

ZhangHuangbin wrote:

By the way, do you have a password in file "config" under iRedMail-0.9.3 directory?

Yes, there is a password in the "config" file.  And as I said, even when I explicitly reset it for all of the "root" users, I can still get in without a password.

Very strange.

8

Re: No root password for Mysql?

Could you please show us FULL content of file iRedMail-0.9.3/runtime/install.log? Maybe there's something wrong when iRedMail tried to reset MYSQL root password.

9

Re: No root password for Mysql?

ZhangHuangbin wrote:

Could you please show us FULL content of file iRedMail-0.9.3/runtime/install.log? Maybe there's something wrong when iRedMail tried to reset MYSQL root password.

Here you go.

Post's attachments

install.log 10.94 kb, 2 downloads since 2016-01-19 

You don't have the permssions to download the attachments of this post.

10

Re: No root password for Mysql?

No error during resetting MySQL root password. I have no idea yet. sad

11

Re: No root password for Mysql?

Just did a fresh install on Ubuntu 15.10.  Same thing.

Maybe it's something to do with the Ubuntu packages?

12

Re: No root password for Mysql?

I tried again on my testing machine (Ubuntu 15.10), cannot reproduce this issue. sad

Is it possible to setup a fresh/clean base server, and let me try the iRedMail installation? i'd like to add some debug option in iRedMail, maybe we can find something interesting.

13

Re: No root password for Mysql?

UPDATE: i can reproduce this issue with MariaDB backend, but not MySQL. I will try to fix it. Stay tuned.

14

Re: No root password for Mysql?

I figured out why it happened. Please check file /etc/mysql/mariadb.conf.d/mysqld.cnf:

#
# * Unix socket authentication plugin
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/
plugin-load-add         = auth_socket.so

And:

MariaDB [mysql]> select User,Host,plugin from user where User='root';
+------+-----------+-------------+
| User | Host      | plugin      |
+------+-----------+-------------+
| root | localhost | unix_socket |
| root | u15       | unix_socket |
| root | 127.0.0.1 | unix_socket |
| root | ::1       | unix_socket |
+------+-----------+-------------+

If remove 'unix_socket' in `mysql.plugin` column, root user must login with a password.

15

Re: No root password for Mysql?

I have the same problem with MySQL: no root password needed for login, with a fresh install of iRedMail ou Ubuntu 16.04.1 LTS. Tried your remedy for MariaDB but I could not find the "plugin-load-add = auth_socket.so" directive on the /etc/mysql/mysql.conf.d file. What am I doing wrong? Thank you!

16

Re: No root password for Mysql?

Just run the sql command mentioned in my last post:

MariaDB [mysql]> select User,Host,plugin from user where User='root';

17

Re: No root password for Mysql?

Hello Zhang, here's what I did:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'my_new_password';

Worked like a charm.

Before this I created another user with admin privileges, just in case!

Thank you for the help!

18

Re: No root password for Mysql?

Hi,

I just did a fresh install on Ubuntu 16.04 LTS (Apache, Mysql), same issue, mysql -u root allow me to log in to mysql without password.

I did the

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'my_new_password';

and now if I do a mysql -u root -p
it asks for the password

But mysql -u root still lets me get in without one

Any idea ?

19

Re: No root password for Mysql?

Check file /root/.my.cnf.

20

Re: No root password for Mysql?

Hi Zhang,

Thanks for your response !

I have this inside :

[client]
user=root
password="my_correct_mysql_root_password"

But still, mysql -u root and voilà, I'm in....

21

Re: No root password for Mysql?

Do you have 'unix_socket' plugin enabled for root user? Check sql table "mysql.user" please.