Open link in a new tab

Content

Expand project menu

Backup script fails

Hello again ;-),

I try to create a backup to update from 8.1.0 to 8.2.0 and it fails to backup the mysql DB:

sudo openproject run backup
* Generating database backup...mysqldump: Got error: 1045: "Access denied for user 'root'@'localhost' (using password: YES)" when trying to connect
 done
/var/db/openproject/backup/mysql-dump-20190107182143.sql.gz
* Generating SVN repositories backup... done
/var/db/openproject/backup/svn-repositories-20190107182143.tar.gz
* No Git repositories folder. Ignoring.
* Generating attachments backup... done
/var/db/openproject/backup/attachments-20190107182143.tar.gz
* Saving configuration... done
/var/db/openproject/backup/conf-20190107182143.tar.gz

The configured user was used to migrate all the data from another system. A connection with HeidiSQL works fine. So it should basically work. I found an old bug ticket here. But this seems not my issue, when I check with 

openproject config:get DATABASE_URL

I get the stored URL to the mysql2 database:

mysql2://USER:PW@127.0.0.1:3306/openproject

KR,

Tobias

Message actions

Hi Tobias,

thanks for raising this issue. The backup script should simply take the value out of DATABASE_URL which you can check with openproject config:get DATABASE_URL. It will not use the root user unless that's specified in the database URL

The relevant section of the script can be found here.

https://github.com/opf/openproject/blob/v8.1.0/packaging/scripts/backup#L22-L47

Best,

Oliver

Message actions

Hi Oliver,

the DATABASE_URL is configured and stored in the /etc/openproject/conf.d/database file. So this should be fine. You also send me a direct message about this topic, is there any way to fix the backup script manually for me? I would like to avoid to do it manually. I also want to use the script for daily backup.

Thanks,

Tobias

Message actions

Hi Tobias,

I'll reach out via email.

Best,

Oliver

Message actions

The actual issue is the password is being URL-encoded for use in DATABASE_URL , but is not unencoded in the backup script.

Bug ticket for tracking:

Message actions

The error above comes when I used the escape string %40 instead of @ in the password. So escaping does not help. Using another password solved the problem. I copy this also to the bug.

Message actions

Yes, exactly the escaped password will not work in the backup script, because the value needs to be decoded before passing to MySQL. I verified this error on my local installation and believe we're actually talking about the same problem :-)

Best,

Oliver

Message actions

Ahh  you mean the escaping needs to be decoded again. Got it. Now it makes sense to me ;-).