Error, access denied for user 'root'@'localhost' (using password: YES)

I am trying to use the mysql service in Github Actions, but to no luck. I get the following error

Access denied for user 'root'@'localhost' (using password: YES)

My job is the following:

test:
name: Test
needs: install
services:
mysql:
image: mysql:8.0
ports:
- '8888:3306'
env:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_DATABASE: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: '10.x'
- run: mysql --port 8888 -u root -prootpass -e 'CREATE DATABASE IF NOT EXISTS test;'

I cant seem to get it to work. Any help is appreciated. The pull request for my repository for the test setup can be found here: https://github.com/morsby/medmcq/pull/399

mysql will ignore the port specified unless you also specify the host and that host is specified as something other than “localhost”.

Try specifying this as “–host 127.0.0.1 --port 8888”

1 Like