rsnapshot creates empty database backup sql file

Discussion in 'Installation/Configuration' started by Poliman, Jul 28, 2017.

  1. Poliman

    Poliman Member

    I used tutorial https://www.howtoforge.com/set-up-r...hots-and-backup-of-mysql-databases-on-debian/. Unfortunatelly after execute command rsnapshot hourly I have next hourly directory:
    Code:
    root@s1:/var/cache/rsnapshot# ls
    hourly.0  hourly.1  hourly.2  hourly.3  hourly.4  plik.sh
    but inside it:
    Code:
    root@s1:/var/cache/rsnapshot# ls -l hourly.4/localhost/mysql_backup/mysqldump_all_databases.sql
    -rw------- 1 root root 0 Jul 28 15:37 hourly.4/localhost/mysql_backup/mysqldump_all_databases.sql
    SQL file is empty although I have few databases on server:
    Code:
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | dbispconfig        |
    | mysql              |
    | performance_schema |
    | phpmyadmin         |
    | roundcube          |
    | sys                |
    +--------------------+
    7 rows in set (0.00 sec)
    
    I've found information I could create in /root/.my.cnf file and inside it:
    Code:
    #
    # The MySQL database server configuration file.
    #
    # You can copy this to one of:
    # - "/etc/mysql/my.cnf" to set global options,
    # - "~/.my.cnf" to set user-specific options.
    #
    # One can use all long options that the program supports.
    # Run program with --help to get a list of available options and with
    # --print-defaults to see which it would actually understand and use.
    #
    # For explanations see
    # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
    
    #
    # * IMPORTANT: Additional settings that can override those from this file!
    #   The files must end with '.cnf', otherwise they'll be ignored.
    #
    [client]
    user     = root
    password = my_pass
    host     = localhost
    
    
    !includedir /etc/mysql/conf.d/
    !includedir /etc/mysql/mysql.conf.d/
    
    and after create of this file I modified in "/usr/local/bin/backup_mysql.sh" line:
    Code:
    /usr/bin/mysqldump --defaults-file=/etc/mysql/debian.cnf --all-databases > mysqldump_all_databases.sql
    to
    Code:
    /usr/bin/mysqldump --defaults-file=/root/.my.cnf --all-databases > mysqldump_all_databases.sql
    but without expected result.
     
    Last edited: Jul 28, 2017
  2. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    You can run the command from /usr/local/bin/backup_mysql.sh manually to see what's going wrong
     
  3. Poliman

    Poliman Member

    I found out what was wrong. Default database backup script says that I need create /root/.my.cnf file and inside it should be the lines:
    Code:
    [client]
    user    = root
    password = my_pass
    host    = localhost
    but it's wrong. Proper lines inside this file should be:
    Code:
    [mysqldump]
    user = root
    password = my_pass
    and then - without any restart - command
    Code:
    rsnapshot hourly
    do the job. But I see another problem. All tables from each database are inside one file but I don't see there any SQL lines for databases creation, only tables.
     

Share This Page