How to resolve this error?
output:
./mysql-backup.sh: Permission denied
try
chmod 755 mysql-backup.sh
i tried 755, 777, error output:
-bash: ./mysql-backup.sh: /bin/bash^M: bad interpreter: No such file or director
the mysql dump command works as I modify the script to insert this command
mysqldump -u root -p traccar > traccar.sql
with automated user and password?
Try run from root directory
i tried on root directory and on root folder. Not work :(
root@ubuntu:~# ./mysql-backup.sh
bash: ./mysql-backup.sh: Permission denied ( root folder)
root@ubuntu:~# bash: ./mysql-backup.sh: No such file or directory ( root directory)
Did you do in root dir?
chmod 755 mysql-backup.sh
. /mysql-backup.sh
yes, output is: -bash: ./mysql-backup.sh: /bin/bash^M: bad interpreter
did you edit this script under windows ?
@Slawek jak zrobić restore MySQL Twoim skryptem?
Thanks I fixed, it was a setting in the wrong notepad++ I had to set the software as unix for saving files. now it works.
if it can be useful for others this is the solution:
Unix uses different line endings so can't read the file you created on Windows. Hence it is seeing ^M as an illegal character. (My ERROR)
If you want to write a file on Windows and then port over, make sure your editor is set to create files in UNIX format.
In notepad++ in the bottom right of the screen, it tells you the document format. By default, it will say Dos\Windows. To change it go to
settings->preferences
new document / default directory tab
select the format as unix and close
create a new document
@Przemyslaw
np:
gunzip 2021-03-14-traccar.gz
mysql -u root -p traccar < 2021-03-14-traccar
@Slawek
Just the command you're reporting or do you need a zip extractor?
my file is : 2021-03-14-traccar.gz
i need to install gunzip?
Thanks
should be in ubuntu system
gunzip 2021-03-14-traccar.gz
or
gzip -d 2021-03-14-traccar.gz
Zrobiłem wszystko od początku, łącznie z wywaleniem certbota, letsencrypt i apache2 i teraz wszystko mi działa, tylko nie rozumiem dlaczego instalując mysql-server ustawiam swoje hasło a potem muszę używać hasła root, np jak robię backup Twoim skryptem.
Pozdrawiam.