Docker Mysql with GitHub Action error

Hello Dears,

I Don’t know where to put my issue so i will put it here
(Kindly if i should put it at another place please inform me)

I have this issue when i run my GitHub action Pipeline :

GitHub Action Pipeline:


name: Run Docker Image, Show Databases, and Tables

on:
  push:
    paths: .github/workflows/my-flow2.yml

jobs:
  build:
    runs-on: ubuntu-latest
    container: (abc)/mysql-Image

    steps:
      - uses: actions/checkout@v3
      
      
      - name: Wait for MySQL to start
        run: sleep 90  # Adjust the sleep time as necessary


      
      - name: Show databases
        run: mysql -uroot -prootpassword -e "SHOW DATABASES;"  # Show databases

Error in GitHub actions :

Run mysql -uroot -prootpassword -e “SHOW DATABASES;”

Warning: arning] Using a password on the command line interface can be insecure.

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

Error: Process completed with exit code 1.


My Dockerfile:

# Use the official MySQL image from the Docker Hub
FROM mysql:latest

# Environment variables for MySQL
ENV MYSQL_ROOT_PASSWORD=rootpassword
ENV MYSQL_DATABASE=school
ENV MYSQL_USER=user
ENV MYSQL_PASSWORD=password

# Add the initialization SQL script
COPY init.sql /docker-entrypoint-initdb.d/

# Expose MySQL port
EXPOSE 3306


Can you help me?

I see a checkout step, and a sleep step, but no step that actually starts the database

Thank you for your response, i already at another actions starts database…
kindly find below all of my tests and in each one what is the error that i faced, can you help me?


0s

Run service mysql start

service: command not found

Error: Process completed with exit code 127.


Run systemctl mysql start

systemctl: command not found

Error: Process completed with exit code 127.


Run mysqld &

2024-08-18T22:43:27.077228Z 0 [System] [MY-015015] [Server] MySQL Server - start.

2024-08-18T22:43:27.266427Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 9.0.1) starting as process 39

Warning: 8T22:43:27.275339Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 48be92af-5db3-11ef-9cb8-0242ac120002.

)2024-08-18T22:43:27.278390Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.

)Error: -18T22:43:27.298059Z 1 [ERROR] [MY-012592] [InnoDB] Operating system error number 2 in a file operation.

Error: -18T22:43:27.298092Z 1 [ERROR] [MY-012593] [InnoDB] The error means the system cannot find the path specified.

)Error: -18T22:43:27.298100Z 1 [ERROR] [MY-012594] [InnoDB] If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.

)Error: -18T22:43:27.298108Z 1 [ERROR] [MY-012646] [InnoDB] File ./ibdata1: ‘open’ returned OS error 71. Cannot continue operation

)Error: -18T22:43:27.298149Z 1 [ERROR] [MY-012981] [InnoDB] Cannot continue operation.

Run mysql -uroot -prootpassword -e “SHOW DATABASES;”

Run mysql -uroot -prootpassword -e “SHOW DATABASES;”

Warning: arning] Using a password on the command line interface can be insecure.

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

Error: Process completed with exit code 1.


Run mysqld &

2024-08-18T22:45:12.630509Z 0 [System] [MY-015015] [Server] MySQL Server - start.

2024-08-18T22:45:12.832196Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 9.0.1) starting as process 39

Warning: 8T22:45:12.841478Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 87aaafe4-5db3-11ef-9e33-0242ac120002.

2024-08-18T22:45:12.845494Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.

Error: -18T22:45:12.866000Z 1 [ERROR] [MY-012592] [InnoDB] Operating system error number 2 in a file operation.

Error: -18T22:45:12.866035Z 1 [ERROR] [MY-012593] [InnoDB] The error means the system cannot find the path specified.

Error: -18T22:45:12.866043Z 1 [ERROR] [MY-012594] [InnoDB] If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.

Error: -18T22:45:12.866051Z 1 [ERROR] [MY-012646] [InnoDB] File ./ibdata1: ‘open’ returned OS error 71. Cannot continue operation

Error: -18T22:45:12.866063Z 1 [ERROR] [MY-012981] [InnoDB] Cannot continue operation.

Wait for MySQL to start

20s

Run sleep 20

Check MySQL Status

Run mysqladmin -uroot -prootpassword ping

Warning: n: [Warning] Using a password on the command line interface can be insecure.

amysqladmin: connect to server at ‘localhost’ failed

)error: ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)’

Check that mysqld is running and that the socket: ‘/var/run/mysqld/mysqld.sock’ exists!

Error: Process completed with exit code 1.

I don’t know, but I think your issue may be with GitHub Actions, I believe asking in a related forum would be more helpful

Thank you for your support, I will.