Hi there,
It seems that whatever I do, I can’t get either Python’s mysqlalchemy or mysql client to connect to a server.
I’m trying to use either a base Debian image or the mysql:5.7 image and I’m met with this error:
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (2003, "Can't connect to MySQL server on '127.0.0.1' (111)") (Background on this error at: http://sqlalche.me/e/e3q8)
/root/.local/share/virtualenvs/api-2w_u5qGM/lib/python3.6/site-packages/MySQLdb/connections.py:204: OperationalError
I’ve also tried a custom Debian image with mysql installed.
I’d love any help with this as I’ve been trying for a few hours now and just can’t get it to work.
version: 2
jobs:
build:
docker:
- image: circleci:python
environment:
- MYSQL_PASSWORD='test_pw'
- MYSQL_DATABASE='test_db'
- MYSQL_ROOT_HOST=%
- DB_HOST=127.0.0.1
- DB_PORT=3306
- image: mysql:5.7
environment:
- MYSQL_PASSWORD=test_pw
- MYSQL_DATABASE=loans
- MYSQL_ROOT_HOST=%
- DB_HOST=127.0.0.1
- DB_PORT=3306
steps:
- checkout
- run:
name: Update pipenv
command: |
sudo pip3 install --upgrade pipenv
- run:
name: Install dependencies and run tests
command: |
mysql -u root -h 127.0.0.1 -ptest_pw
cd api && pipenv --three && pipenv install
cp config.template.yml test_config.yml
pipenv run pytest
- run:
name: Setup front end
command: |
cd frontend
yarn install
yarn build
- store_artifacts:
path: test-reports
destination: test-reports

