Configuration
Databases
MySQL

MySQL

GoBackup uses mysqldump utility to export MySQL database into a .sql file.

Install tool

So you need to install mysql-client first.

$ sudo apt install mysql-client 

Config keys

type: mysql

  • host - MySQL server host, default: localhost
  • port - MySQL server port, default: 3306
  • socket - MySQL server, if use socket, for example: /var/run/mysqld/mysqld.sock, default: ``
  • database - database name
  • username - default: root
  • password
  • tables - Array of tables to backup, default: []
  • exclude_tables - Array of tables to exclude from backup, default: []
  • args - Additional options for mysqldump utility, for example: --single-transaction --quick

https://github.com/gobackup/gobackup/blob/main/database/mysql.go (opens in a new tab)

Example

models:
  my_app:
    databases:
      my_app:
        type: mysql
        host: localhost
        port: 3306
        database: my_app_production
        username: root
        password: root
        tables:
          - users
          - posts
        exclude_tables:
          - logs
          - logs_1
        args: --single-transaction --quick