Hotsync mysql error

hotsync
mysql

(Wayne Bilger) #1

NethServer Version: 7.5.1804 (final)
Module: hotsync

I just started testing hotsync on my production server, and I am getting these mysql errors emailed to root on master every run.

ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)

I can login to mysql on master using root password without issue.
All /var/lib/nethserver/ data is synced to slave, but nothing is synced from /var/lib/mysql.


(Markus Neuberger) #2

Usually root should be able to login without password because the password from /root/my.cnf is used. This password is stored in /var/lib/nethserver/secrets/mysql.
Did you change the root password? Please change it back to the original one from the files.


(Wayne Bilger) #3

/var/lib/nethserver/secrets/mysql matches /root/my.cnf
I did not change the root password in mysql, that I remember anyway, and don’t think I would have had any reason to so so. But, I can login to mysql with the the same root password as NS, so either I changed it, or it is a legacy setting. This NS was installed probably about 18 months ago.


(Markus Neuberger) #4

Could it be database sync is disabled?

http://docs.nethserver.org/en/v7/hotsync.html#slave

Found another thread:


(Wayne Bilger) #5

database sync is enabled. I tried reenabling it again in case, but same errors.
I had seen that thread before, but it does not apply as the issue there I think was trying to access on slave, but I am having issues on master.

Does default install of NS set root mysql password to same as NS root password? If so, that is what it is set to. Then is the issue that mysql requires the user to enter a password, and it is not supposed to require a password when logged in as root? Does hotsync run as root, and assume this?


(Markus Neuberger) #6

No, you set the NS root password.
The mysql root password is a random one and stored in /var/lib/nethserver/secret/mysql.


(Wayne Bilger) #7

Has that always been the case?
As, the password in /var/lib/nethserver/secret/mysql is the same as /root/.my.cnf, but I cannot login to mysql from cli as root with just ‘mysql’, it gives me the same error;

ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)

But, I can login with ‘mysql -u root -p’ and use my same NS root password.


(Markus Neuberger) #8

Yes, it’s setup like this at install.

Please change the mysql root password to the one from /var/lib/nethserver/secret/mysql. Then you should be able to login with mysql again and hotsync shouldn’t throw an error.

Enter mysql with root password:

use mysql;
update user set password=PASSWORD("SECRET") where User='root';
flush privileges;
exit

(Wayne Bilger) #9

Thanks. That worked.
But, there is still nothing synced to /var/lib/mysql, or are they not restored until slave promotion?


(Markus Neuberger) #10

I assume they are restored at promotion but I didn’t test it…