Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,207
Community Members
 
Community Events
176
Community Groups

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

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

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

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.

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.

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 Community Events