The SqlBak application connects your computer to sqlbak.com and allows you to manage database backups from the web. In this post, you will see what commands and parameters it supports on Linux.
There are full and short forms of each command. The full form looks like:
sqlbak --<command> --<parameter1>=<value1> --<parameter2>=<value2> ...
Example:
sqlbak --test-connection --connection-id=20878
The short form is like:
sqlbak -<c> -<p1> <value1> -<p2> <value2>
Example:
sqlbak -tc -ci 20878
Note also that you need to run any command under a user with root rights.
Get the help
sqlbak --help [--command=<command_name>] sqlbak -h [-c <command_name>]
This command outputs the complete list of supported commands with short descriptions.
To get help for a specific command add the –command (-c) parameter with the name of the command, for example:
sqlbak --help --command=update-settings sqlbak -h -c us
Get app’s version
sqlbak --version sqlbak -v
Get the current status
sqlbak --info sqlbak -i
This command outputs the server’s name, sqlbak.com account it’s connected to, and other useful information. For example, you may see something like this:
Server name: sqlbak_server SqlBak.com account: SqlBakAccount Status: the computer is registered SqlBak.com service Logging: the app logging is activated
Register the server in sqlbak.com
sqlbak --register --key=<secret_key> [--name=<server_name>] [--mysqldump-path=<path>] [--mysql-path=<path>] [--pgdump-path=<path>] [--psql-path=<path>] [--sqlcmd-path=<path>] [--mssql-data=<path>]
sqlbak -r -k <secret_key> [-n <server_name>] [-md <path>] [-ms <path>] [-pd <path>] [-ps <path>] [-sq <path>] [-sqd <path>]
This command registers your computer as a server in sqlbak.com. After that, you will see it on the dashboard and will be able to run backup and maintenance jobs on your machine.
The only required parameter here is –key (-k). It receives your secret key that you can find on the Download page when you’re logged in to sqlbak.com.
Example:
sqlbak --register --key=b9acdefc-9c57-4114-9772-9ba058c55196 --name=my_server sqlbak -r -k b9acdefc-9c57-4114-9772-9ba058c55196 -n my_server
The optional parameters are:
- –name (-n) specifies the name of the server that will be displayed on sqlbak.com (if omitted the hostname is used)
- –mysql-path (-ms) sets path to MySQL (default is /usr/bin/mysql)
- –mysqldump-path (-md) sets path to mysqldump utility (default is /usr/bin/mysqldump)
- –psql-path (-ps) sets path to PostgreSQL (default is /usr/bin/psql)
- –pgdump-path (-pd) sets path to pg_dump utility (default is /usr/bin/pg_dump)
- –sqlcmd-path (-sq) sets path to sqlcmd utility (default is /opt/mssql-tools/bin/sqlcmd)
- –mssql-data (-sqd) sets path to path to MS SQL data directory (default is /var/opt/mssql/data/)
Update server’s settings
sqlbak --update-settings [--name=<server_name>] [--mysqldump-path=<path>] [--mysql-path=<path>] [--pgdump-path=<path>] [--psql-path=<path>] [--sqlcmd-path=<path>] [--mssql-data=<path>]
sqlbak -us [-n <server_name>] [-md <path>] [-ms <path>] [-pd <path>] [-ps <path>] [-sq <path>] [-sqd <path>]
With this command, you can change the server’s name along with paths to DBMS and utilities mentioned in the previous section.
Example:
sqlbak --update-settings --name=my_server --mysqldump-path=/usr/local/bin/mysqldump --pgdump-path=/usr/local/bin/pg_dump sqlbak -us -n my_server -md /usr/local/bin/mysqldump -pd /usr/local/bin/pg_dump
Unregister the server from sqlbak.com
sqlbak --unregister sqlbak -u
This command removes the connection between the computer and sqlbak.com. After the connection is removed you will no longer see this computer on the dashboard and in the list of available servers on sqlbak.com.
Connect to DBMS
sqlbak --add-connection --db-type=mysql|postgresql|mssql --user=<user_name> [--password=<password>] [--connection-type=<type>] [--host=<host>] [--port=<port>] [--use-ssh=Y|N] [--ssh-host=<host>] [--ssh-user=<user>] [--ssh-password=<password>] [--ssh-port=<port>] [--ssh-local-mapped-port=<port>]
sqlbak -ac -dt mysql|postgresql|mssql -u <user_name> [-p <password>] [-ct <type>] [-h <host>] [-P <port>] [-ssh Y|N] [-sshh <host>] [-sshu <user>] [-sshup <password>] [-sshp <port>] [-sshmp <port>]
In order to backup databases, you need to establish a connection between the SqlBak application and one or more DBMS and this is what this command for.
When adding a connection, SqlBak will immediately try to connect and test it. If this fails the connection will not be added.
There are two required parameters:
- –db-type (-dt) specifies the type of database you add a connection to it should be one of the following values: MySQL, PostgreSQL, MS SQL, Azure, or Mongo
- –user (-u) specifies a user name for DMBS connection
For example:
sqlbak --add-connection --db-type=mysql --user=admin --password=my_password sqlbak -ac -dt mysql -u admin -p my_password
The optional parameters are:
- –connection-type (-ct) specifies a connection type, at the moment the only supported value is TCP/IP
- –host (-h) specifies a host address where DBMS is installed (default is localhost)
- –password (-p) allows you to specify user’s password right in the command line (which is not secure enough); if you omit this parameter the password will be asked interactively
- –port (-P) specifies a port for DBMS connection, the default values are: MySQL = 3306, PostgreSQL = 5432, MS SQL = 1433
- –use-ssh (-ssh) allows you to establish DBMS connection through an ssh tunnel, can be either Y or N, default is N
If you’re using ssh tunnel then you need to specify some additional parameters:
- –ssh-host (-sshh) specifies the remote host for ssh session
- –ssh-port (-sshp) specifies the port to connect to the host (optional, default is 22)
- –ssh-user (-sshu) specifies ssh user name
- –ssh-password (-sshup) specifies ssh user password
- –ssh-local-mapped-port (-sshmp) specifies the local mapped port for ssh tunnel (optional, default is 3306)
Get existing DBMS connections
sqlbak --show-connection sqlbak -sc
This command outputs all DBMS connections in the following format:
Connection-Id: 1, DBMS-Type: mssql, Connection-Name: localhost:1433 Connection-Id: 2, DBMS-Type: mysql, Connection-Name: localhost:3306
Get current DBMS connection settings
sqlbak --show-connection --connection-id=<connection_id> sqlbak -sc -ci <connection_id>
This command requires a connection identifier that you can get from the list of existing connections (see the previous section). As a result, you will see something like:
Connection-Id: 2, DBMS-Type: mysql, Connection-Name: localhost:3306, Host: localhost, Port: 3306, User: root, Use-SSH: 0, SSH-Host: None, SSH-Port: 22, SSH-Local-Mapped-Port: 3306, SSH-User: None
Update DBMS connection
sqlbak --update-connection --connection-id=<id> [--db-type=mysql|postgresql|mssql] [--user=<user_name>] [--password=<password>] [--connection-type=<type>] [--host=<host>] [--port=<port>] [--use-ssh=Y|N] [--ssh-host=<host>]
[--ssh-user=<user>] [--ssh-password=<password>] [--ssh-port=<port>] [--ssh-local-mapped-port=<port>] sqlbak -uc -ci <id> [-dt mysql|postgresql|mssql] [-u <user_name>] [-p <password>] [-ct <type>] [-h <host>] [-P <port>] [-ssh Y|N] [-sshh <host>] [-sshu <user>] [-sshup <password>] [-sshp <port>] [-sshmp <port>]
This command allows changing the settings of an existing DBMS connection. It requires only one parameter: –connection-id (-ci). You can retrieve this identifier from the list of existing connections (see Get existing DBMS connections section).
Other parameters are optional and described in Connect to DBMS section.
Test DBMS connection
sqlbak --test-connection --connection-id=<id> sqlbak -tc -ci <id>
This command checks whether the sqlbak app is able to connect to DBMS using the current connection settings. If everything is fine you should see:
Connection-Id: 2, DBMS-Type: mysql, Connection-Name: localhost:3306 The connection is tested successfully.
Remove DBMS connection
sqlbak --remove-connection --connection-id=<id> sqlbak -rc -ci <id>
This command removes a DBMS connection.
Get job list
sqlbak --jobs sqlbak -j
This command shows information of all jobs configured for this server on sqlbak.com. The output will be like this:
Job-Id: 23668, Job-Name: New Backup job, Connection-Id: 1, DBMS-Type: mysql, Connection-Name: localhost:3306
Run a job
sqlbak --run-job --job-id=<job_id> sqlbak -rj -ji <job_id>
This command allows you to immediately start job execution. The only thing you need to know is a job identifier that you can get from the job list (see the previous section). While the job is running you will see the detailed log on the console.
Set logging ON and OFF
sqlbak --set-logs --activate=Y|N sqlbak -sl -a Y|N
This command activates or deactivates sqlbak app logging. These logs can be sent to the support team for the support case investigation. The logging is activated by default.
Upload logs to the support team
sqlbak --upload-logs sqlbak -ul
This command uploads sqlbak logs to the support team for the future support case investigation
When the logs are uploaded you should see the following message:
The logs have been successfully uploaded.
ubuntu@ubuntu-B250M-D2V:/etc/mysql/mysql.conf.d$ curl -sSL https://sqlbak.com/download/linux/latest | sudo bash -s 606f965d-7bcb-4b79-84a8-853e21c4be6d
bash: line 1: #!/bin/bash: No such file or directory
Reading package lists… Done
Building dependency tree
Reading state information… Done
apt-transport-https is already the newest version (1.2.32ubuntu0.2).
gnupg2 is already the newest version (2.1.11-6ubuntu2.1).
The following package was automatically installed and is no longer required:
snapd-login-service
Use ‘sudo apt autoremove’ to remove it.
0 upgraded, 0 newly installed, 0 to remove and 59 not upgraded.
Get a public gpg.key
OK
Add a link to SqlBak app’s package to the repository list
Update the package repository list
Hit:1 http://linux.teamviewer.com/deb stable InRelease
Hit:2 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu xenial InRelease
Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Hit:4 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Get:5 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:6 https://sqlbak.com/deb/1/1/50 stable InRelease [1,639 B]
Hit:7 http://dl.google.com/linux/chrome/deb stable InRelease
Get:8 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Fetched 327 kB in 1s (174 kB/s)
Reading package lists… Done
Install the app
Reading package lists… Done
Building dependency tree
Reading state information… Done
sqlbak is already the newest version (1.1.50).
The following package was automatically installed and is no longer required:
snapd-login-service
Use ‘sudo apt autoremove’ to remove it.
0 upgraded, 0 newly installed, 0 to remove and 59 not upgraded.
Register the application on sqlbak.com …
Handling a console command has failed. Failed to register this server. “Failed to register this server. “Failed to make a request to remote server. PSB:0002 Failed to register a new server. Please try again or contact the service provider.
PSB:0006 Failed to register server “ubuntu-B250M-D2V”. The server with the same name is already connected. Please change the name and connect again.”. “. .
ubuntu@ubuntu-B250M-D2V:/etc/mysql/mysql.conf.d$
Hello,
It seems you run the following command twice:
curl -sSL https://sqlbak.com/download/linux/latest | sudo bash -s 606f965d-7bcb-4b79-84a8-853e21c4be6d
There is no need to run the command again, you have already installed the application and registered it on sqlbak.com
You can check all the connected servers at your “Dashboard” https://sqlbak.com/dashboard/ page.
If for some reason your server is offline, please restart the service:
sudo service sqlbak restart
Is it possible to run sqlbak without registering? My VM and SQL servers are in an internal network with no access to the internet.
Thank you
Hi Felipe,
Sorry, but there is no way to do it. For the correct work of the application, a stable internet connection is required.
Hi,
I have a MariaDB server in a VM which is only accessible from localhost, which means I have to connect through a SSH tunnel to connect from the outside. So far, so good – problem is that I’ve setup the SSH server to only authorize connections by certificate. That doesn’t seem possible from sqlbak?
Hi Hans Thorsager,
In SqlBak it is possible to connect via an SSH tunnel, but there is no way to set (attach) an SSL certificate yet.
Hello,
I have successfully setup SqlBak on my CentOS 7 server. It can connect to a remote mssql server and I was able to create a job through https://sqlbak.com/dashboard. However, when I run the job I get the following error message:
ERROR Job execution error: Failed to backup a DBMS – “TDPA-Prod-SQL-V1” . “Msg 40510, Level 16, State 1, Server tdapsqlsvr, Line 1 Statement ‘BACKUP DATABASE’ is not supported in this version of SQL Server. “.
Any idea how I can get around this error?
Thank you
Felipe
Hi Felipe,
It seems that you try to backup Azure Server. To do it please specify “azure” values when adding the db_type parameter.
I’m trying to configure the FTP destination.
When i click test to check it, after 10 seconds the dashboard display the following error:
Failed to test the destination. “‘>’ not supported between instances of ‘str’ and ‘int'”.
I check my connection parameters, credentials, everything but i can’t to add this destination.
Why?
Thanks a lot.
Hi Jose,
Could you please contact our support team https://sqlbak.com/support to check and resolve the issue?
Sorry for the inconvenience.
Hi I am getting this postgresql backup via sqlbal on centos 7.
Following is error:
Handling a console command has failed. Failed to add DBMS connection. “table Connection has no column named Database”. .
Tried running a test back and log returned below:
Job execution error: mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Error: ‘Access denied; you need (at least one of) the PROCESS privilege(s) for this operation’ when trying to dump tablespaces
mysqldump: Got error: 1227: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation when doing refresh
Hi Frank,
You get an error message that you need at least one of the RELOAD privilege(s) for the operation when doing refresh. You can find more details on how to provide the needed privileges at https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html
Also, you can find more useful suggestions on the web.
Thank you, got it working:)
Hi,
This doesn’t seem to work with RaspberryPi anymore:
user@raspberrypi:~ $ sudo apt-get update
Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:2 http://archive.raspberrypi.org/debian buster InRelease
Get:3 https://sqlbak.com/raspberry_deb/1/2/11 stable InRelease [1,619 B]
Get:4 https://sqlbak.com/raspberry_deb stable InRelease [1,619 B]
Fetched 3,238 B in 2s (1,685 B/s)
Reading package lists… Done
N: Skipping acquire of configured file ‘main/binary-armhf/Packages’ as repository ‘https://sqlbak.com/raspberry_deb/1/2/11 stable InRelease’ doesn’t support architecture ‘armhf’
N: Skipping acquire of configured file ‘main/binary-armhf/Packages’ as repository ‘https://sqlbak.com/raspberry_deb stable InRelease’ doesn’t support architecture ‘armhf’
Kind Regards,
Chris
Hi Chris,
Sorry, but for now we don’t support architecture ‘armhf’.
Sorry for the inconvenience.
Hi Chris,
We just what to let you know, that now SqlBak supports ‘armhf’ architecture. Could you please try again?
Thank you!
Hi
When sudo apt update I get:
E: The repository ‘https://sqlbak.com/deb stable Release’ no longer has a Release file.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Hi Ben,
We made a decision to abandon the repository, the current installation instructions can be found on the “Download” https://sqlbak.com/download page at the “Linux” tab.
To prevent apt-get from throwing errors, please delete the file /etc/apt/sources.list.d/sqlbak.list
Thank you!
Hi, are there any instructions on fully removing the application?
Hi Hans,
You can remove the application in the following way:
sudo apt-get remove sqlbak
rm -rf /opt/sqlbak
If you have any other questions, please let us know.
Thank you!
Hello
Been having the error
execution error: /usr/pgsql-13/bin/pg_dump: unrecognized option ‘–oids’
any help on how to bypass it
Hi pregtech,
To resolve the issue, please go to your backup job’s settings page, scroll down to the “Job Options” section, click on the “More Settings…” link and disable the “Dump object identifiers” option.
If you have any other questions, please let us know.
Thank you!
Is the latest SQLBAK supported on ubuntu 14?
Hi Edwin,
Sorry, but SqlBak does not support Ubuntu version 14 as it is a very old version.
Sorry for the inconvenience.
We have a server with two scheduled jobs, a db backup job and a maintenance one, db connection tested successfully, and we can run the jobs from the dashboard and they are working, but they are not working by themselves according the the schedule configurations.
Hi Simon,
Could you please contact our support team https://sqlbak.com/support to resolve the issue?
Thank you and sorry for the inconvenience.
I am unclear about a few things
-is there a way to encrypt backups before sending to your service?
-can I backup MariaDB as a drop in replacement for MySQL?
-can I do point in time restore operations?
Hi Dean,
> Is there a way to encrypt backups before sending to your service?
Sorry, but there is no easy way to do this. For SQL Server, you can use TDE, but there is no way to do it for MySQL and PostgreSQL. With SqlBak you can set the encrypt option (enable the “Encrypt compressed files” option) to encrypt the backups before sending them to destinations. Note that the backups are not stored on the SqlBak side, they are sent to your destinations.
> Can I backup MariaDB as a drop in replacement for MySQL?
Yes, you can do it.
> Can I do point in time restore operations?
You can try to perform incremental backups every 15 minutes and then restore them. Note, the process to restore incremental; backups may take longer time due to the chain of incremental backups. To resolve the issue, please performer full backups from time to time.
Hi sqlbak,
I have a little problem connecting to mysql host, here’s the case:
I have a debian server and installed docker in it, there are 2 containers installed mysql container and sqlbak container, both of which connect using the same network that is “Internal” And can communicate with each other
In the mysql container I just typed the command ‘mysql’ and the output results I directly logged into the mysql server without typing username and password
In the sqlbak container everything is installed perfectly and registered in the sqlbak dashboard, the problem is when I create a new DBMS they ask for username and password to add it, Meanwhile in the mysql container I didn’t type the username and password. What should I input in the DBMS if I want to add mysql without username and password?
Thank you,
Best regards
Hi Pacnet,
Sorry, but login and password are required to connect. Could you please let us know how did you manage to set a connection without a password?
My docker app has Postgres 15.1 and reading the error below seems to me a mismatch of version.
Could you update the docker app with last version compatible of pg_dump?
Thanks Alen
Job execution error: pg_dump: error: server version: 15.1 (Debian 15.1-1.pgdg110+1); pg_dump version: 14.5 (Ubuntu 14.5-1.pgdg18.04+1)
pg_dump: error: aborting because of server version mismatch
I tried to update setting… but I GOT an error:
“‘ascii’ codec can’t encode character ‘с’ in position 9: ordinal not in range(128)”
From my consolle in my docker app:
sqlbak –update-settings –pgdump-path=/usr/lib/postgresql/15/bin/pg_dump –psql-path=/usr/lib/postgresql/15/bin/psql
Hi Alen,
We have updated the Docker image. Could you please upgrade the image and check if the issue is resolved?
Thank you and sorry for the inconvenience.
Hi, if I install a server with tis example
sudo sqlbak -r -k SECRET KEY
When installing it I failed to setup correctly. Rather than edit I would like to remove and start again. Please give me guidance.
Thanks
Hi Nigel Stanley,
Please use:
sudo service sqlbak stop
rm -rf /opt/sqlbak
then you can install SqlBak again
curl -o sqlbak.deb https://sqlbak.com/download/linux/latest/sqlbak.deb
sudo apt-get install ./sqlbak.deb