0

Here is my sam template for taking database backup trigger:

- none  
  
pool:  
  vmImage: ubuntu-latest  
  
steps:  
- script: echo Hello, world!  
  displayName: 'Run a one-line script'  

- script: |
    sudo apt-get -f install -o Dpkg::Options::="--force-overwrite"
    sudo apt-get update
    sudo apt-get purge mysql\*
    rm -rf /var/lib/mysql
    rm -rf /etc/mysql
    dpkg -l | grep -i mysql
    sudo apt-get clean
    updatedb
    sudo apt-get install mysql-client
  displayName: 'Getting Mysql Client'
- script: |
    mysql -V
  displayName: 'Displaying Mysql Client version'
- script: |
    mysqldump -h host --triggers --routines -u username --password="password" -P 3306 SDA_RMA_DE > dev_sda_db_bkp_test.sql
  displayName: 'Taking Backup'

When I try running pipeline it got failed in taking backup step mysqldump:

Got error: 2003: Can't connect to MySQL server on 'host' (110) when trying to connect

Please help me by saying how to overcome this error

djdomi
  • 1,377
  • 3
  • 10
  • 19
vithya m
  • 1
  • 1
  • Do you have a *working* way to connect to mysql on this server? E.g. which application does that and how it is configured? – Nikita Kipriyanov Dec 27 '21 at 13:21
  • `-h host` seems to be wrong. Did you mean `-h localhost`? – digijay Dec 27 '21 at 17:37
  • No I have given main host only but I didnt mentioned here – vithya m Dec 28 '21 at 06:46
  • @NikitaKipriyanov Sorry I m very to this templates can you please provide some examples like how it needs to be done – vithya m Dec 28 '21 at 06:54
  • @NikitaKipriyanov Now maually we are taking backup through ec2 instance only, need to mention that connection here or any other way there please help us we are trying to make it automate through pipeline the above mentioned template is for automating db backup and if you have ay idea on this please let me know – vithya m Dec 28 '21 at 07:01
  • You didn't answered to my question at all. Forget about automation until later. Do you have any means to make a working connection to this database server? From the target application, from `mysql` console client? Which options that connection uses? – Nikita Kipriyanov Dec 28 '21 at 09:41
  • In Ec2 instance only connection establishes – vithya m Dec 28 '21 at 09:45

0 Answers0