Backup-Data Failing with S50mysql-dump-tables FAILED

NethServer Version: NethServer release 7.6.1810
Module: Backup

I cannot get the Backup-data to succeed.
the sql-dump-tables fails. I have follow these suggestions in another thread.

service mysqld stop
yum remove nethserver-mysql mysql-server
rm -rf /var/lib/mysql
rm -f /root/.my.cnf
rm -f /etc/my.pwd
yum install nethserver-mysql

but I get the same failure
I also reinstalled my roundcubemail but it can no longer connect to the db. but one issue at a time. What can I do to troubleshoot my backup-data - any suggestions?


Here are the log outputs
Backup: backup-data
Backup started at 2019-04-04 01:00:02
Event pre-backup-data: FAIL
Backup status: FAIL

** /var/log/messages**
Apr 28 01:00:07 main esmith::event[31800]: Action: /etc/e-smith/events/pre-backup-data/S20nethserver-backup-config-predatabackup SUCCESS [4.640261]
Apr 28 01:00:13 main esmith::event[31800]: Action: /etc/e-smith/events/pre-backup-data/S20nethserver-restore-data-duc-index SUCCESS [5.401965]
Apr 28 01:00:13 main esmith::event[31800]: Action: /etc/e-smith/events/pre-backup-data/S50mysql-dump-tables FAILED: 1 [0.199199]
Apr 28 01:00:14 main esmith::event[31800]: Action: /etc/e-smith/events/pre-backup-data/S50nethserver-webtop5-backup SUCCESS [0.696454]
Apr 28 01:00:14 main esmith::event[31800]: Event: pre-backup-data FAILED

Have you changed the root password of mysql? Or you can access via ssh without password?

as I said I uninstalled and reinstalled but have not changed the mysql password

But can you access mysql without insert password?
(Only with command “mysql”)

Sorry no

root@main ~]# mysql
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql.sock’ (2)

1 Like

Can you try

systemctl start mysqld

and then enter with mysql command?

If it works enable it with systemctl enable mysqld

Thank you.

No it does not start. I restarted the server and tried to start mysql

mysqld.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2019-05-02 16:05:51 MDT; 3s ago
Process: 8053 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=1/FAILURE)

May 02 16:05:50 systemd[1]: Starting MariaDB database server…
May 02 16:05:51 mariadb-prepare-db-dir[8053]: Database MariaDB is not initialized, but the directory /var/lib/mysql is not empty, so initialization cannot be done.
May 02 16:05:51 mariadb-prepare-db-dir[8053]: Make sure the /var/lib/mysql is empty before running mariadb-prepare-db-dir.
May 02 16:05:51 systemd[1]: mysqld.service: control process exited, code=exited status=1
May 02 16:05:51 systemd[1]: Failed to start MariaDB database server.
May 02 16:05:51 systemd[1]: Unit mysqld.service entered failed state.
May 02 16:05:51 systemd[1]: mysqld.service failed.

I found that the /var/lib/mysql directory is missing. I added mysql directory but then it gives me the error that I have incorrect rights on the directory but I don’t know what rights it needs.

1 Like

Please create the directory /var/lib/mysql with these permissions:

drwxr-xr-x. 7 mysql mysql 218 Mar 31 20:53 mysql

Commands are:
chmod -R 755 /var/lib/mysql
chown -R mysql:mysql /var/lib/mysql

Try and then retry to start mysql.
Post the output if there are some errors.

Thank you :slight_smile:

mysql now starts
when I try to access mysql with just mysql I get this
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)

1 Like

Ok, now follow this procedure:

grep password .my.cnf

Copy this password and then launch this commands:

service mysqld stop
mysqld_safe --skip-grant-tables &
set password for 'root'@'localhost' = PASSWORD('yourcopiedpwd');

And then:

systemctl stop mysqld
systemctl start mysqld

If from service interface mysql remains stopped launch this other commands:

mysqladmin shutdown
systemctl start mysqld

Then I suggest you to create an admin account with all privileges with this mysql command:
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'adminpassword';
You can use it for application like phpmyadmin.

Try to reboot the server and check if it works properly by log into mysql with mysql command. Process starts automatically only if you did systemctl enable mysqld before.

Then you can check if backup works properly with command
backup-data -b backup-data

Wait for your feedback.

1 Like

Fantastic! That has solved my backup problem. Backup was successful. Interesting that the nethserver dashboard still reports last backup as an errror.

Thanks so much!!!

Is there any chance you can give me some guidance with getting roundcube back online? I get a database error connection failed message. I am guessing the mysql password needs to be changed or that uninstalling and reinstalling has left the db missing or unconfigured.
Any thoughts?

1 Like

It’s normal. Nethserver dashboard show only scheduled backup status.

Try these commands:

mysql -e "drop database roundcubemail"



1 Like

Well that was quick and easy. the db did not exist and the roundcubemail-conf created the user and the db and we are off to the races!!!

Thanks again you are extremely helpful!

1 Like

Please mark the topic as solved. Thank you :slight_smile: