question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MySQL server has gone away

See original GitHub issue

I get this error from time to time:

SQLSTATE[HY000] [2006] MySQL server has gone away

I just re-run the job multiple times until it works. This is my conf for MySQL setup:

- name: Setup MySQL
        uses: mirromutth/mysql-action@v1.1
        with:
          mysql database: test
          mysql user: test
          mysql password: test

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

17reactions
NBajancacommented, Feb 19, 2021

After a lot of time with inconsistent errors, I did this:

(...)
env:
      MYSQL_ROOT_PASSWORD: password
          
    steps:
      (...) first steps, but the sooner you call MySQL, the better
      
      - name: Setup MySQL
        uses: mirromutth/mysql-action@v1.1
        with:
          mysql root password: $MYSQL_ROOT_PASSWORD

      (...) all other things that don't need MySQL

      - name: Wait for MySQL
        run: |
          while ! mysqladmin ping --host=127.0.0.1 --password=$MYSQL_ROOT_PASSWORD --silent; do
            sleep 1
          done

      (...) steps where you need MySQL

If you think it is a good approach, I don’t have a problem adding this note in the README file (and doing a PR) so new users don’t waste time.

4reactions
almasaeed2010commented, Feb 6, 2021

Adding a sleep 15 command to wait for the mysql server to become available fixed this issue for me

- name: Wait for MySQL
  run: sleep 15
Read more comments on GitHub >

github_iconTop Results From Across the Web

B.3.2.7 MySQL server has gone away
The most common reason for the MySQL server has gone away error is that the server timed out and closed the connection. In...
Read more >
"MySQL server has gone away" error - Solution(s)
The MySQL server has gone away error, which means that the MySQL server (mysqld) timed out and closed the connection. By default, MySQL...
Read more >
How do I fix the error "Mysql Server has gone away"? FAQ
How do I fix the error “Mysql Server has gone away”? · Server timed out and closed the connection. To fix, check that...
Read more >
MySQL error 2006: mysql server has gone away
This generally indicates MySQL server connectivity issues or timeouts. Can generally be solved by changing wait_timeout and max_allowed_packet ...
Read more >
How to Fix the "MySQL Server Has Gone Away" Error ... - Kinsta
An Introduction to the “MySQL Server Has Gone Away” Error · There's a broken table within your database. Your database became corrupted so...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found