Hi I am using CircleCI 2.0. I am wondering how do I get access to the mysql shell if I am using mysql in a container? I am currently getting the error mysql: command not found.
mysql --version
Shell: /bin/bash -eo pipefail
/bin/bash: mysql: command not found
Exited with code 127
config.yml
version: 2
jobs:
build:
docker:
- image: node:6.9.5
- image: mysql:5.6.34
environment:
PRODUCTION_USERNAME: test
MYSQL_ALLOW_EMPTY_PASSWORD: yes
working_directory: ~/app
steps:
- checkout
- run:
name: Install Dependencies
command: npm install
- run:
name: Run tests
command: mysql --version
I would eventually like to run the sql below using the mysql command
echo “Creating $DB_USER db user”
echo “GRANT USAGE ON . TO ‘$DB_USER’@‘%’;DROP USER ‘$DB_USER’@‘%’;CREATE USER ‘$DB_USER’@‘%’ IDENTIFIED BY ‘$DB_PASS’;GRANT ALL PRIVILEGES ON . TO ‘$DB_USER’@‘%’ WITH GRANT OPTION;” | mysql -uroot -h localhost
echo “GRANT USAGE ON . TO ‘$DB_USER’@‘localhost’;DROP USER ‘$DB_USER’@‘localhost’;CREATE USER ‘$DB_USER’@‘localhost’ IDENTIFIED BY ‘$DB_PASS’;GRANT ALL PRIVILEGES ON . TO ‘$DB_USER’@‘localhost’ WITH GRANT OPTION;” | mysql -uroot -h localhost