vitalidze / traccar-web

Traccar Web UI mod
http://traccar.litvak.su/
152 stars 145 forks source link

mysql backup #986

Open ghost opened 7 years ago

ghost commented 7 years ago

Hello,

I modify my cron for backup each night the mysql database my command line is :

30 00 * * * /bin/bash -c 'mysqldump --single-transaction --lock-tables=0 -h localhost -umyself -p mypass traccar --add-drop-table > /home/traccar/Dropbox/backup/Traccar/data/traccar.sql'

When I run this, I get a traccar.sql inside the folder, but , the file is at 0 bits !!!

the database name is OK , I check with : show databases;

What is wrong please ?

Thanks.

vitalidze commented 7 years ago

The syntax of your mysqldump command is probably incorrect. What happens when you run it from command line? You can use google to find out right syntax.

jolypas commented 7 years ago

I am using a little script called from crontab to backup and send to an ftp server

file_name="/home/xxxxx/BACKUPS/traccar_`date '+%Y-%m-%d'`.sql.gz"
mysqldump -u root -pmypassd traccar | gzip -9 > $file_name
wput --basename "/home/xxxxx/BACKUPS/" $file_name ftp://user:password@ftpservername/traccar/

if it can help ...

ghost commented 7 years ago

I think I begin to see what's wrong.

I've a ! inside the mysql passwd , part of it is !s85

When I try the mysqldump in command line, I get a -bash: !s85: event not found

How can I bypass this without modifying the mysql passwd ? Thanks.

vitalidze commented 7 years ago

You should be able to escape that symbol with \ notation, something like \!s85 might work. Another option is to put password in double quotes.

ghost commented 7 years ago

Wouahou, work fine, and now, if one day I need to restore the backuped sql database ? What is the command line please ?

vitalidze commented 7 years ago

You can use google to find that command. This is not a forum for supporting MySQL database administration.