'GitHub Actions mysql service not working (Access denied)
I try to use GitHub actions to check the functionality of my application. I'm using the mysql service and want to set up a database with a SQL file named db_structure.sql. But as soon as I run the action, it just gives me a Access denied error message.
Here's my full workflow:
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
cypress_testing:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: database
MYSQL_USER: foo
MYSQL_PASSWORD: bar
MYSQL_ROOT_PASSWORD: bar
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: npm install --save-dev
- name: Create DB structure
run: |
sudo /lib/systemd/systemd-sysv-install enable mysql
sudo systemctl enable mysql.service
sudo systemctl start mysql.service
sudo systemctl status mysql.service
sudo mysql -h 127.0.0.1 -ufoo -pbar database < db_structure.sql
# I would then run my tests here
And here is the full error message:
ERROR 1045 (28000): Access denied for user 'foo'@'localhost' (using password: YES)
I already tried adding -h 127.0.0.1 to the mysql command. I also tried starting the service before running the mysql command.
Thanks for your help in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
