Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Help with pipeline error : "bash: mysql: command not found"

Sébastien Despont January 1, 2023

I am a new user of pipeline.

I really don't understand why I get the error "bash: mysql: command not found" with my pipeline script. The mysql client is well installed ?!

Is there someone to help me?

image: composer:2.0
definitions:
services:
mysql:
image: mysql:5.7
variables:
MYSQL_DATABASE: 'myDB'
MYSQL_ROOT_PASSWORD: 'root'
MYSQL_USER: 'myUser'
MYSQL_PASSWORD: 'mypwd'

pipelines:
default:
- step:
name: InstallMySQL
script:
- apt-get update && apt-get install -y mysql-client
- mysql -h 127.0.0.1 -u myUser -pmypwd -e "SHOW DATABASES"
services:
- mysql

3 answers

1 accepted

0 votes
Answer accepted
Sébastien Despont January 2, 2023 edited

For the records, I have managed to use mysql client in PHP images by installing mariadb-client like this:

 

 

image: php:8.0-apache
definitions:
services:
mysql:
image: mysql:5.7
variables:
MYSQL_DATABASE: 'myDB'
MYSQL_ROOT_PASSWORD: 'root'
MYSQL_USER: 'myUser'
MYSQL_PASSWORD: 'mypwd'

pipelines:
default:
- step:
name: InstallMySQL
script:
- apt-get update && apt-get install -y mariadb-client
- mysql -h 127.0.0.1 -u myUser -pmypwd -e "SHOW DATABASES"
services:
- mysql

 

1 vote
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 1, 2023

Welcome to the Atlassian Community!

This suggests that your build environment does not have a path defined that includes the directory that apt is installed in, or you are running it on a system that doesn't use apt for its package management.  (The "path" I mean here is the list of directories a process looks in for executables when asked to run something)

apt is usually installed in /usr/bin, and you will need to have admin rights to run it.

Sébastien Despont January 1, 2023 edited

Thank you very much for your answer. OK I was using the default image suggested by Bitbucket pipeline creation interface for a PHP project, which doesn't permit to use APT apparently.

0 votes
Sébastien Despont January 1, 2023

In fact, the error comes from the installation command "bash: apt-get: command not found". But I don't understand how to fix this error.

 

Any idea?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events