MySQL won't start

I’m having trouble getting Tutor running on my Mac. MySQL always seems tangled up. The common advice here is to 1) ensure there’s enough RAM for Docker (mine is 8Gb), and 2) to delete the MySQL data and start over, which I have done (see below).

What else can I try to fix this?

$ tutor config printroot

/Users/nedbatchelder/Library/Application Support/tutor

$ sudo rm -rf “$(tutor config printroot)/data/mysql”

$ tutor local quickstart # I omitted some of the output to fit the topic in the 32Kb limit.

==================================================
        Interactive platform configuration
==================================================
Are you configuring a production platform? Type 'n' if you are just testing Tutor on your local computer [y/N] n
As you are not running this platform in production, we automatically set the following configuration values:
    LMS_HOST = local.overhang.io
    CMS_HOST = studio.local.overhang.io
    ENABLE_HTTPS = False
Your platform name/title [NedX]
Your public contact email address [ned@edx.org]
The default language code for the platform [en]
Configuration saved to /Users/nedbatchelder/Library/Application Support/tutor/config.yml
Environment generated in /Users/nedbatchelder/Library/Application Support/tutor/env
==============================================
        Stopping any existing platform
==============================================
...
================================================
        Database creation and migrations
================================================
Initialising all services...
Initialising mysql...
docker-compose -f /Users/nedbatchelder/Library/Application Support/tutor/env/local/docker-compose.yml -f /Users/nedbatchelder/Library/Application Support/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /Users/nedbatchelder/Library/Application Support/tutor/env/local/docker-compose.jobs.yml run --rm mysql-job sh -e -c echo "Initialising MySQL..."
mysql_connection_max_attempts=10
mysql_connection_attempt=0
until mysql -u root --password="EzU7p4sM" --host "mysql" --port 3306 -e 'exit'
do
    mysql_connection_attempt=$(expr $mysql_connection_attempt + 1)
    echo "    [$mysql_connection_attempt/$mysql_connection_max_attempts] Waiting for MySQL service (this may take a while)..."
    if [ $mysql_connection_attempt -eq $mysql_connection_max_attempts ]
    then
      echo "MySQL initialisation error" 1>&2
      exit 1
    fi
    sleep 10
done
echo "MySQL is up and running"

# edx-platform database
mysql -u root --password="EzU7p4sM" --host "mysql" --port 3306 -e 'CREATE DATABASE IF NOT EXISTS openedx;'
mysql -u root --password="EzU7p4sM" --host "mysql" --port 3306 -e 'GRANT ALL ON openedx.* TO "openedx"@"%" IDENTIFIED BY "SDcw7gJx";'
[+] Running 1/0
 ⠿ Container tutor_local-mysql-1  Running                                                                                                                  0.0s
Initialising MySQL...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on 'mysql' (111)
    [1/10] Waiting for MySQL service (this may take a while)...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on 'mysql' (111)
    [2/10] Waiting for MySQL service (this may take a while)...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on 'mysql' (111)
    [3/10] Waiting for MySQL service (this may take a while)...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on 'mysql' (111)
    [4/10] Waiting for MySQL service (this may take a while)...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on 'mysql' (111)
    [5/10] Waiting for MySQL service (this may take a while)...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on 'mysql' (111)
    [6/10] Waiting for MySQL service (this may take a while)...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on 'mysql' (111)
    [7/10] Waiting for MySQL service (this may take a while)...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on 'mysql' (111)
    [8/10] Waiting for MySQL service (this may take a while)...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on 'mysql' (111)
    [9/10] Waiting for MySQL service (this may take a while)...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on 'mysql' (111)
    [10/10] Waiting for MySQL service (this may take a while)...
MySQL initialisation error
Error: Command failed with status 1: docker-compose -f /Users/nedbatchelder/Library/Application Support/tutor/env/local/docker-compose.yml -f /Users/nedbatchelder/Library/Application Support/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /Users/nedbatchelder/Library/Application Support/tutor/env/local/docker-compose.jobs.yml run --rm mysql-job sh -e -c echo "Initialising MySQL..."
mysql_connection_max_attempts=10
mysql_connection_attempt=0
until mysql -u root --password="EzU7p4sM" --host "mysql" --port 3306 -e 'exit'
do
    mysql_connection_attempt=$(expr $mysql_connection_attempt + 1)
    echo "    [$mysql_connection_attempt/$mysql_connection_max_attempts] Waiting for MySQL service (this may take a while)..."
    if [ $mysql_connection_attempt -eq $mysql_connection_max_attempts ]
    then
      echo "MySQL initialisation error" 1>&2
      exit 1
    fi
    sleep 10
done
echo "MySQL is up and running"

# edx-platform database
mysql -u root --password="EzU7p4sM" --host "mysql" --port 3306 -e 'CREATE DATABASE IF NOT EXISTS openedx;'
mysql -u root --password="EzU7p4sM" --host "mysql" --port 3306 -e 'GRANT ALL ON openedx.* TO "openedx"@"%" IDENTIFIED BY "SDcw7gJx";'

$ tutor local logs mysql

docker-compose -f /Users/nedbatchelder/Library/Application Support/tutor/env/local/docker-compose.yml -f /Users/nedbatchelder/Library/Application Support/tutor/env/local/docker-compose.prod.yml --project-name tutor_local logs mysql
tutor_local-mysql-1  | 2022-02-02 18:03:50+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.35-1debian10 started.
tutor_local-mysql-1  | 2022-02-02T18:03:51.083228Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
tutor_local-mysql-1  | 2022-02-02T18:03:51.096654Z 0 [Note] mysqld (mysqld 5.7.35) starting as process 1 ...
tutor_local-mysql-1  | 2022-02-02T18:03:51.120102Z 0 [Note] InnoDB: PUNCH HOLE support available
tutor_local-mysql-1  | 2022-02-02T18:03:51.120187Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
tutor_local-mysql-1  | 2022-02-02T18:03:51.120201Z 0 [Note] InnoDB: Uses event mutexes
tutor_local-mysql-1  | 2022-02-02T18:03:51.120820Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
tutor_local-mysql-1  | 2022-02-02T18:03:51.121136Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
tutor_local-mysql-1  | 2022-02-02T18:03:51.121143Z 0 [Note] InnoDB: Using Linux native AIO
tutor_local-mysql-1  | 2022-02-02T18:03:51.124238Z 0 [Note] InnoDB: Number of pools: 1
tutor_local-mysql-1  | 2022-02-02T18:03:51.127173Z 0 [Note] InnoDB: Using CPU crc32 instructions
tutor_local-mysql-1  | 2022-02-02T18:03:51.131394Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
tutor_local-mysql-1  | 2022-02-02T18:03:51.161125Z 0 [Note] InnoDB: Completed initialization of buffer pool
tutor_local-mysql-1  | 2022-02-02T18:03:51.166598Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
tutor_local-mysql-1  | 2022-02-02T18:03:51.229932Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
tutor_local-mysql-1  | 2022-02-02T18:03:51.449123Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
tutor_local-mysql-1  | 2022-02-02T18:03:51.450316Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
tutor_local-mysql-1  | 2022-02-02T18:03:51.563372Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
tutor_local-mysql-1  | 2022-02-02T18:03:51.574594Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
tutor_local-mysql-1  | 2022-02-02T18:03:51.574863Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
tutor_local-mysql-1  | 2022-02-02T18:03:51.575845Z 0 [Note] InnoDB: Waiting for purge to start
tutor_local-mysql-1  | 2022-02-02T18:03:51.627367Z 0 [Note] InnoDB: 5.7.35 started; log sequence number 5186884
tutor_local-mysql-1  | 2022-02-02T18:03:51.628764Z 0 [Note] Plugin 'FEDERATED' is disabled.
tutor_local-mysql-1  | 2022-02-02T18:03:51.631492Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
tutor_local-mysql-1  | 2022-02-02T18:03:51.805467Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
tutor_local-mysql-1  | 2022-02-02T18:03:51.805547Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
tutor_local-mysql-1  | 2022-02-02T18:03:51.805568Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
tutor_local-mysql-1  | 2022-02-02T18:03:51.805580Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
tutor_local-mysql-1  | 2022-02-02T18:03:51.815194Z 0 [Note] InnoDB: Buffer pool(s) load completed at 220202 18:03:51
tutor_local-mysql-1  | 2022-02-02T18:03:51.830754Z 0 [Warning] CA certificate ca.pem is self signed.
tutor_local-mysql-1  | 2022-02-02T18:03:51.833489Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
tutor_local-mysql-1  | 2022-02-02T18:03:51.844980Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
tutor_local-mysql-1  | 2022-02-02T18:03:51.845484Z 0 [Note] IPv6 is available.
tutor_local-mysql-1  | 2022-02-02T18:03:51.846147Z 0 [Note]   - '::' resolves to '::';
tutor_local-mysql-1  | 2022-02-02T18:03:51.846408Z 0 [Note] Server socket created on IP: '::'.
tutor_local-mysql-1  | 2022-02-02T18:03:51.852319Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
tutor_local-mysql-1  | 2022-02-02T18:03:52.496493Z 0 [Note] Event Scheduler: Loaded 0 events
tutor_local-mysql-1  | 2022-02-02T18:03:52.497291Z 0 [Note] mysqld: ready for connections.
tutor_local-mysql-1  | Version: '5.7.35'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
tutor_local-mysql-1  | 2022-02-02T18:23:36.786379Z 0 [Note] Giving 0 client threads a chance to die gracefully
tutor_local-mysql-1  | 2022-02-02T18:23:36.786464Z 0 [Note] Shutting down slave threads
tutor_local-mysql-1  | 2022-02-02T18:23:36.788545Z 0 [Note] Forcefully disconnecting 0 remaining clients
tutor_local-mysql-1  | 2022-02-02T18:23:36.788645Z 0 [Note] Event Scheduler: Purging the queue. 0 events
tutor_local-mysql-1  | 2022-02-02T18:23:36.788882Z 0 [Note] Binlog end
tutor_local-mysql-1  | 2022-02-02T18:23:36.835103Z 0 [Note] Shutting down plugin 'ngram'
tutor_local-mysql-1  | 2022-02-02T18:23:36.836179Z 0 [Note] Shutting down plugin 'partition'
tutor_local-mysql-1  | 2022-02-02T18:23:36.836610Z 0 [Note] Shutting down plugin 'BLACKHOLE'
tutor_local-mysql-1  | 2022-02-02T18:23:36.836636Z 0 [Note] Shutting down plugin 'ARCHIVE'
tutor_local-mysql-1  | 2022-02-02T18:23:36.836647Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
tutor_local-mysql-1  | 2022-02-02T18:23:36.836695Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
tutor_local-mysql-1  | 2022-02-02T18:23:36.836704Z 0 [Note] Shutting down plugin 'MyISAM'
tutor_local-mysql-1  | 2022-02-02T18:23:36.836724Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
tutor_local-mysql-1  | 2022-02-02T18:23:36.836734Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
tutor_local-mysql-1  | 2022-02-02T18:23:36.836744Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
tutor_local-mysql-1  | 2022-02-02T18:23:36.836757Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
tutor_local-mysql-1  | 2022-02-02T18:23:36.836769Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
tutor_local-mysql-1  | 2022-02-02T18:23:36.836778Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
tutor_local-mysql-1  | 2022-02-02T18:23:36.836790Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
tutor_local-mysql-1  | 2022-02-02T18:23:36.836926Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839368Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839447Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839475Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839488Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839499Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839510Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839642Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839660Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839675Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839683Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839694Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839708Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839718Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839732Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839749Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839758Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839782Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839793Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839825Z 0 [Note] Shutting down plugin 'INNODB_CMP'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839843Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839853Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839863Z 0 [Note] Shutting down plugin 'INNODB_TRX'
tutor_local-mysql-1  | 2022-02-02T18:23:36.839873Z 0 [Note] Shutting down plugin 'InnoDB'
tutor_local-mysql-1  | 2022-02-02T18:23:36.842175Z 0 [Note] InnoDB: FTS optimize thread exiting.
tutor_local-mysql-1  | 2022-02-02T18:23:36.845734Z 0 [Note] InnoDB: Starting shutdown...
tutor_local-mysql-1  | 2022-02-02T18:23:36.951628Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
tutor_local-mysql-1  | 2022-02-02T18:23:36.962841Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 220202 18:23:36
tutor_local-mysql-1  | 2022-02-02T18:23:37.978909Z 0 [Note] InnoDB: Shutdown completed; log sequence number 5186912
tutor_local-mysql-1  | 2022-02-02T18:23:37.981537Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
tutor_local-mysql-1  | 2022-02-02T18:23:37.981653Z 0 [Note] Shutting down plugin 'MEMORY'
tutor_local-mysql-1  | 2022-02-02T18:23:37.981724Z 0 [Note] Shutting down plugin 'CSV'
tutor_local-mysql-1  | 2022-02-02T18:23:37.981746Z 0 [Note] Shutting down plugin 'sha256_password'
tutor_local-mysql-1  | 2022-02-02T18:23:37.981765Z 0 [Note] Shutting down plugin 'mysql_native_password'
tutor_local-mysql-1  | 2022-02-02T18:23:37.982015Z 0 [Note] Shutting down plugin 'binlog'
tutor_local-mysql-1  | 2022-02-02T18:23:37.987822Z 0 [Note] mysqld: Shutdown complete
tutor_local-mysql-1  |
tutor_local-mysql-1  | 2022-02-02 20:01:51+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.35-1debian10 started.

Is the mysql container still up and running? You can verify that with docker ps | grep mysql. A common issue is that the “dev” container is up at the same time as the “local” container, and this may cause connection errors.

1 Like

The mysql container is running. In fact, now when I try tutor local quickstart again, it can’t stop the MySQL container:

==============================================
        Stopping any existing platform
==============================================
docker-compose -f /Users/nedbatchelder/Library/Application Support/tutor/env/local/docker-compose.yml -f /Users/nedbatchelder/Library/Application Support/tutor/env/local/docker-compose.prod.yml --project-name tutor_local stop
[+] Running 16/17
 ⠿ Container tutor_local-mysql-permissions-1          Stopped                                                                                              0.0s
 ⠿ Container tutor_local-cms-worker-1                 Stopped                                                                                              0.1s
 ⠿ Container tutor_local-lms-worker-1                 Stopped                                                                                              0.0s
 ⠿ Container tutor_local-caddy-1                      Stopped                                                                                              0.0s
 ⠿ Container tutor_local-mfe-1                        Stopped                                                                                              0.0s
 ⠿ Container tutor_local-cms-1                        Stopped                                                                                              0.0s
 ⠿ Container tutor_local-lms-1                        Stopped                                                                                              0.0s
 ⠿ Container tutor_local-cms-permissions-1            Stopped                                                                                              0.0s
 ⠿ Container tutor_local-mysql-1                      Error while Stopping                                                                                24.1s
 ⠿ Container tutor_local-lms-permissions-1            Stopped                                                                                              0.0s
 ⠿ Container tutor_local-smtp-1                       Stopped                                                                                              0.1s
 ⠿ Container tutor_local-mongodb-1                    Stopped                                                                                              0.0s
 ⠿ Container tutor_local-redis-1                      Stopped                                                                                              0.1s
 ⠿ Container tutor_local-elasticsearch-1              Stopped                                                                                              0.2s
 ⠿ Container tutor_local-mongodb-permissions-1        Stopped                                                                                              0.1s
 ⠿ Container tutor_local-redis-permissions-1          Stopped                                                                                              0.0s
 ⠿ Container tutor_local-elasticsearch-permissions-1  Stopped                                                                                              0.0s
Error response from daemon: cannot stop container: 4eb5c4e8ce72d866fc567f9af834223aaf6a4b0558294c0d16e0289faea4a2ac: tried to kill container, but did not receive an exit event
Error: Command failed with status 1: docker-compose -f /Users/nedbatchelder/Library/Application Support/tutor/env/local/docker-compose.yml -f /Users/nedbatchelder/Library/Application Support/tutor/env/local/docker-compose.prod.yml --project-name tutor_local stop

It looks like some Docker black witchcraft is going on. Did you attempt to manually stop the container?

docker stop tutor_local-mysql-1 

That didn’t work to stop it either. I restarted all of Docker Desktop. Now all is well :slight_smile:

1 Like

A post was split to a new topic: MySQL initialisation error

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.