Error while running command on script task

Hello,

I am trying to integrate DB steps with one of our release process where we are planning to get a dump from Production DB and restore it Stag DB. We are using MySQL 5.7 as backend and we face 2 problems here.

Problem #1:- Deployment steps show as a failed when command throws warning message.
I am trying to run “mysqldump -h x.x.x.x -u myuser -pmypassword --databases mydb > db.sql” and it works well on terminal but yes it give us a warning but DB dump successfull. When I put same command on “Run a scipt” task than it’s gives a warning message and task marked as failure.

Problem #2:- Error message Access denied for user ‘ODBC’@‘localhost’.
To avoid first problem, we are using “mysql_config_editor” where we are creating login profile and it works as expected on termincal/cmd but when we run this command “mysqldump --login-path=myProfile --databases myDB > C:\MySqlDump\myDB.sql” than it gave us above error which means it doesn’t pick my login profile that’s why it’s connect through default user which is “ODBC”

Hi,

Thanks for getting in touch.

The task is marked as failed because the script exits with code 2. Any exit code other than 0 will cause the step to fail.

The problem with access denied may be caused because Tentacle can not find your profile file. Ensure that you can run mysqldump with the same user that Tentacle is configured to run as (https://octopus.com/docs/installation/installing-tentacles/running-tentacle-under-a-specific-user-account-for-use-in-powershell). You may need to change the user, or provide extra permissions to access the profile.

I hope this helps.

Cheers,
Shane

Hello,

I am not running a scrip on Tentacle instead I have run this on Octopus Server. In this case, how could I achieve this

Hi,

The Octopus Server user can be configured in the same way the Tentacle user is configured, through Services.msc. By default it is using the Local System account. If you are not comfortable changing the Octopus Server user, you could install a Tentacle on the Octopus Server machine and configure the user for that account.

Cheers,
Shane

Thanks. Let me give it a try and I will get back to you

Thank you so much, it works after changing Log On on user on services