MySQL Server shuts down frequently and won't start again now - mysql

OS: Ubuntu 16.04.1 LTS xenial
I installed MySQL on my server on AWS and it was working fine, but after we started getting much traffic on-site, it started failing frequently. To fix it, I usually restart the service or server which works but for only a few minutes/hours and then it fails again. Now MySQL doesn't start again even after I restart the server.
Running sudo systemctl start mysql i get this message
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
And this is the content logged in /var/log/mysql/error.log
2017-02-08T11:35:32.352942Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-02-08T11:35:32.352975Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2017-02-08T11:35:32.509812Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-02-08T11:35:32.510752Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.17-0ubuntu0.16.04.1) starting as process 3060 ...
2017-02-08T11:35:32.514030Z 0 [Note] InnoDB: PUNCH HOLE support available
2017-02-08T11:35:32.514046Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-02-08T11:35:32.514049Z 0 [Note] InnoDB: Uses event mutexes
2017-02-08T11:35:32.514054Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-02-08T11:35:32.514057Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-02-08T11:35:32.514060Z 0 [Note] InnoDB: Using Linux native AIO
2017-02-08T11:35:32.514265Z 0 [Note] InnoDB: Number of pools: 1
2017-02-08T11:35:32.514359Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-02-08T11:35:32.515647Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-02-08T11:35:32.522465Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-02-08T11:35:32.524160Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2017-02-08T11:35:32.535815Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2017-02-08T11:35:32.536689Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 30903245
2017-02-08T11:35:32.536703Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 30904484
2017-02-08T11:35:32.536738Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 30903245 and the end 30904484.
2017-02-08T11:35:32.536747Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2017-02-08T11:35:33.137801Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2017-02-08T11:35:33.137835Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-02-08T11:35:33.137841Z 0 [ERROR] Failed to initialize plugins.
2017-02-08T11:35:33.137843Z 0 [ERROR] Aborting
2017-02-08T11:35:33.137848Z 0 [Note] Binlog end
2017-02-08T11:35:33.137893Z 0 [Note] Shutting down plugin 'MyISAM'
2017-02-08T11:35:33.137914Z 0 [Note] Shutting down plugin 'CSV'
2017-02-08T11:35:33.138111Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

Still don't know what went wrong but deleting the files /var/lib/mysql/ib_logfile* solved it.

please try the following
/etc/init.d/mysql stop
service mysql stop
sudo killall -KILL mysql mysqld_safe mysqld
/etc/init.d/mysql start
systemctl status mysql
And it should show active status for the mysql server

Related

Error: MySQL shutdown unexpectedly XAMPP Plugin 'InnoDB' init function returned error [duplicate]

I restarted my server because it froze (probably the stupidest thing I did so far) and then got some internal server errors. I soon discovered that mysql had failed on startup (service mysql status).
I read the mysql error log( Pastebin ) and started googling.
I'm running Ubuntu at its latest version, mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using EditLine wrapper.
What I tried:
deleting both ib_logfile (after doing a backup) in /var/lib/mysql
apt-get upgrade (I really don't know why)
-checking my.cf for errors
Here is my /var/log/mysql/error.log
2020-08-07T15:43:06.094116Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-08-07T15:43:06.095903Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.31-0ubuntu0.18.04.1) starting as process 952 ...
2020-08-07T15:43:06.100450Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-08-07T15:43:06.100482Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-08-07T15:43:06.100489Z 0 [Note] InnoDB: Uses event mutexes
2020-08-07T15:43:06.100496Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-08-07T15:43:06.100502Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-08-07T15:43:06.100508Z 0 [Note] InnoDB: Using Linux native AIO
2020-08-07T15:43:06.100771Z 0 [Note] InnoDB: Number of pools: 1
2020-08-07T15:43:06.100876Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-08-07T15:43:06.102827Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-08-07T15:43:06.112754Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-08-07T15:43:06.114871Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-08-07T15:43:06.127135Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-08-07T15:43:06.128655Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 7945493345
2020-08-07T15:43:06.128723Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 7945545114
2020-08-07T15:43:06.130551Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 7945493345 and the end 7945545114.
2020-08-07T15:43:06.130573Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2020-08-07T15:43:06.732437Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-08-07T15:43:06.732470Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-08-07T15:43:06.732482Z 0 [ERROR] Failed to initialize builtin plugins.
2020-08-07T15:43:06.732491Z 0 [ERROR] Aborting
2020-08-07T15:43:06.732526Z 0 [Note] Binlog end
2020-08-07T15:43:06.732586Z 0 [Note] Shutting down plugin 'CSV'
2020-08-07T15:43:06.732959Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
If you need more logs/informations, I will provide them.
Thanks, I'm really desperate, I really don't want to loose the past 2 years of my life.
For MYSQL not starting in XAMP
Here is a good fix that worked for me
Navigate to /var/lib/mysql.
If you see log files like, ib_logfile0 and ib_logfile1, rename or
move them to some other folder.
Stop and start the MySQL service.
That`s all.
Before deleting ib_logfile0, ib_logfile1 and ibdata1, I started mysql in InnoDB recovery mod 4 and logged in to phpmyadmin to backup all of my databases. After that I removed the ib files, purged mysql and phpmyadmin, reinstalled them, reconfigured mysql, logged into phpmyadmin and imported my databases.

MYSQL not starting (InnoDB: Plugin initialization aborted with error Generic error)

I restarted my server because it froze (probably the stupidest thing I did so far) and then got some internal server errors. I soon discovered that mysql had failed on startup (service mysql status).
I read the mysql error log( Pastebin ) and started googling.
I'm running Ubuntu at its latest version, mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using EditLine wrapper.
What I tried:
deleting both ib_logfile (after doing a backup) in /var/lib/mysql
apt-get upgrade (I really don't know why)
-checking my.cf for errors
Here is my /var/log/mysql/error.log
2020-08-07T15:43:06.094116Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-08-07T15:43:06.095903Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.31-0ubuntu0.18.04.1) starting as process 952 ...
2020-08-07T15:43:06.100450Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-08-07T15:43:06.100482Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-08-07T15:43:06.100489Z 0 [Note] InnoDB: Uses event mutexes
2020-08-07T15:43:06.100496Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-08-07T15:43:06.100502Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-08-07T15:43:06.100508Z 0 [Note] InnoDB: Using Linux native AIO
2020-08-07T15:43:06.100771Z 0 [Note] InnoDB: Number of pools: 1
2020-08-07T15:43:06.100876Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-08-07T15:43:06.102827Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-08-07T15:43:06.112754Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-08-07T15:43:06.114871Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-08-07T15:43:06.127135Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-08-07T15:43:06.128655Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 7945493345
2020-08-07T15:43:06.128723Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 7945545114
2020-08-07T15:43:06.130551Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 7945493345 and the end 7945545114.
2020-08-07T15:43:06.130573Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2020-08-07T15:43:06.732437Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-08-07T15:43:06.732470Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-08-07T15:43:06.732482Z 0 [ERROR] Failed to initialize builtin plugins.
2020-08-07T15:43:06.732491Z 0 [ERROR] Aborting
2020-08-07T15:43:06.732526Z 0 [Note] Binlog end
2020-08-07T15:43:06.732586Z 0 [Note] Shutting down plugin 'CSV'
2020-08-07T15:43:06.732959Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
If you need more logs/informations, I will provide them.
Thanks, I'm really desperate, I really don't want to loose the past 2 years of my life.
For MYSQL not starting in XAMP
Here is a good fix that worked for me
Navigate to /var/lib/mysql.
If you see log files like, ib_logfile0 and ib_logfile1, rename or
move them to some other folder.
Stop and start the MySQL service.
That`s all.
Before deleting ib_logfile0, ib_logfile1 and ibdata1, I started mysql in InnoDB recovery mod 4 and logged in to phpmyadmin to backup all of my databases. After that I removed the ib files, purged mysql and phpmyadmin, reinstalled them, reconfigured mysql, logged into phpmyadmin and imported my databases.

InnoDB: Header page consists of zero bytes in datafile: ./ibdata1

I am deploying MySQL on openshift (kubernetes) but getting below error
---> 10:01:34 Initializing database ...
---> 10:01:34 Running /opt/rh/rh-mysql57/root/usr/libexec/mysqld --initialize --datadir=/var/lib/mysql/data --ignore-db-dir=lost+found
---> 10:01:35 Starting MySQL server with disabled networking ...
---> 10:01:35 Waiting for MySQL to start ...
2019-10-18T10:01:35.188509Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-10-18T10:01:35.188567Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2019-10-18T10:01:35.325995Z 0 [Note] /opt/rh/rh-mysql57/root/usr/libexec/mysqld (mysqld 5.7.24) starting as process 40 ...
2019-10-18T10:01:35.430574Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-10-18T10:01:35.430612Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-10-18T10:01:35.430621Z 0 [Note] InnoDB: Uses event mutexes
2019-10-18T10:01:35.430627Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-10-18T10:01:35.430634Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.7
2019-10-18T10:01:35.430642Z 0 [Note] InnoDB: Using Linux native AIO
2019-10-18T10:01:35.431024Z 0 [Note] InnoDB: Number of pools: 1
2019-10-18T10:01:35.431174Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-10-18T10:01:35.433296Z 0 [Note] InnoDB: Initializing buffer pool, total size = 2G, instances = 8, chunk size = 128M
2019-10-18T10:01:35.584269Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-10-18T10:01:35.610249Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-10-18T10:01:35.624480Z 0 [ERROR] InnoDB: Header page consists of zero bytes in datafile: ./ibdata1, Space ID:0, Flags: 0. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2019-10-18T10:01:35.624518Z 0 [ERROR] InnoDB: Corrupted page [page id: space=0, page number=0] of datafile './ibdata1' could not be found in the doublewrite buffer.
2019-10-18T10:01:35.624667Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption
---> 10:01:36 Waiting for MySQL to start ...
2019-10-18T10:01:36.225356Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-10-18T10:01:36.225372Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-10-18T10:01:36.225377Z 0 [ERROR] Failed to initialize builtin plugins.
2019-10-18T10:01:36.225380Z 0 [ERROR] Aborting
2019-10-18T10:01:36.225393Z 0 [Note] Binlog end
2019-10-18T10:01:36.225454Z 0 [Note] Shutting down plugin 'CSV'
2019-10-18T10:01:36.233760Z 0 [Note] /opt/rh/rh-mysql57/root/usr/libexec/mysqld: Shutdown complete
I searched on google and they recommend to do following
rm -rf /var/lib/mysql/ib_logfile*
but as you know in docker and kubernetes world as soon as pod is not able to come up we cant login to pod and delete these files. Due to this error MySQL pod is not coming up.
I am using glusterfs and i deleted PVC and recreated but still same error.
Update1:
After recommendation of #Crou i did following changes
I downloaded new "centos/mysql-57-centos7:5.7" image and retry still same issue
I used mysql:5.7 image and now its throwing following error
I deleted PVC and recreated with different size but still same error.
[ERROR] --initialize specified but the data directory has files in it. Aborting.
[ERROR] Aborting
It seems to me that your image is broken, or at least the data you are trying to load.
Even if you do remove the files /var/lib/mysql/ib_logfile* this will break again when pod will be rescheduled.
You can try getting into the pod using kubectl exec -it <pod_name> bash when it is still starting and quickly do the changes. If it's already too late and it just fails within few seconds with crashloopbackoff, you might try fixing this in the dockerfile that is being used to crate the image. If you have no access to the dockerfile, you can create your own dockerfile and build image based on it.
Here is a documentation with Dockerfile reference that might be helpful.
Dockerfile include something like this:
FROM oraclelinux:7-slim
RUN rm -rf /var/lib/mysql/ib_logfile*
EXPOSE 3306 6606 6446 6447 33060
CMD [""]
Please keep in mind this is just a short example and might not work on it self.
I was able to find this github mattlord/Docker-InnoDB-Cluster, maybe it will be of help.
After different retries i am able to solve issues, Following are findings
I observed that when first time i recreate PVC and deploy mysql it take too much time at this line
Running /opt/rh/rh-mysql57/root/usr/libexec/mysqld --initialize --datadir=/var/lib/mysql/data --ignore-db-dir=lost+found
During this time LiveProbe time exaust and it restart the container, which result in subjected error.
I increased the time of initialDelaySeconds under livenessProbe to 240, this time it started mysql after 4 mins
After 4 minutes it shows Starting MySQL server with disabled networking and start doing further.
My applications are able to connect it but i dont know what would be the impact of this?
---> 16:18:24 Running /opt/rh/rh-mysql57/root/usr/libexec/mysqld --initialize --datadir=/var/lib/mysql/data --ignore-db-dir=lost+found
---> 16:22:15 Starting MySQL server with disabled networking ...
---> 16:22:15 Waiting for MySQL to start ...
2019-10-18T16:22:15.752499Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-10-18T16:22:15.772646Z 0 [Note] /opt/rh/rh-mysql57/root/usr/libexec/mysqld (mysqld 5.7.24) starting as process 69 ...
2019-10-18T16:22:15.849580Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-10-18T16:22:15.849613Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-10-18T16:22:15.849617Z 0 [Note] InnoDB: Uses event mutexes
2019-10-18T16:22:15.849621Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-10-18T16:22:15.849624Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.7
2019-10-18T16:22:15.849629Z 0 [Note] InnoDB: Using Linux native AIO
2019-10-18T16:22:15.850236Z 0 [Note] InnoDB: Number of pools: 1
2019-10-18T16:22:15.850459Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-10-18T16:22:15.852211Z 0 [Note] InnoDB: Initializing buffer pool, total size = 2G, instances = 8, chunk size = 128M
2019-10-18T16:22:15.978704Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-10-18T16:22:16.005183Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-10-18T16:22:16.208237Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2019-10-18T16:22:16.402086Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-10-18T16:22:16.414708Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
---> 16:22:17 Waiting for MySQL to start ...
---> 16:22:18 Waiting for MySQL to start ...
2019-10-18T16:22:18.601639Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2019-10-18T16:22:18.608922Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2019-10-18T16:22:18.608943Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2019-10-18T16:22:18.609240Z 0 [Note] InnoDB: Waiting for purge to start
2019-10-18T16:22:18.659387Z 0 [Note] InnoDB: 5.7.24 started; log sequence number 2592555
2019-10-18T16:22:18.659667Z 0 [Note] Plugin 'FEDERATED' is disabled.
2019-10-18T16:22:18.663687Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/data/ib_buffer_pool
2019-10-18T16:22:18.808093Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2019-10-18T16:22:18.808117Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2019-10-18T16:22:18.825225Z 0 [Warning] CA certificate ca.pem is self signed.
2019-10-18T16:22:18.828435Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2019-10-18T16:22:18.885079Z 0 [Note] InnoDB: Buffer pool(s) load completed at 191018 16:22:18
2019-10-18T16:22:18.948358Z 0 [Warning] 'user' entry 'root#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:18.948397Z 0 [Warning] 'user' entry 'mysql.session#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:18.948404Z 0 [Warning] 'user' entry 'mysql.sys#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:18.948428Z 0 [Warning] 'db' entry 'performance_schema mysql.session#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:18.948435Z 0 [Warning] 'db' entry 'sys mysql.sys#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:18.948448Z 0 [Warning] 'proxies_priv' entry '# root#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:19.034170Z 0 [Warning] 'tables_priv' entry 'user mysql.session#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:19.034191Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:19.633088Z 0 [Note] Event Scheduler: Loaded 0 events
2019-10-18T16:22:19.633217Z 1 [Note] Event Scheduler: scheduler thread started with id 1
2019-10-18T16:22:19.633316Z 0 [Note] /opt/rh/rh-mysql57/root/usr/libexec/mysqld: ready for connections.
Version: '5.7.24' socket: '/tmp/mysql.sock' port: 0 MySQL Community Server (GPL)
2019-10-18T16:22:19.634316Z 3 [Note] Your password has expired. To log in you must change it using a client that supports expired passwords.
---> 16:22:19 MySQL started successfully
---> 16:22:19 Setting password for MySQL root user ...

Mgt Development Environment - MySQL suddenly won't start

I have 4 containers using mgt-commerce/mgt-development-environment-7.2. Basically everything runs well until I cannot access the control panel. It returns 500.
After checking the services, logs, etc, it seems like mysql is unable to start. Here is the error log captured in /var/log/mysql/error.log during starting mysql service using sudo service mysql start.
2019-09-26T23:38:43.740283Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2019-09-26T23:38:43.921450Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.26-29) starting as process 1576 ...
2019-09-26T23:38:43.924613Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-09-26T23:38:43.924635Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-09-26T23:38:43.924639Z 0 [Note] InnoDB: Uses event mutexes
2019-09-26T23:38:43.924642Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-09-26T23:38:43.924644Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-09-26T23:38:43.924647Z 0 [Note] InnoDB: Using Linux native AIO
2019-09-26T23:38:43.924859Z 0 [Note] InnoDB: Number of pools: 1
2019-09-26T23:38:43.924920Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-09-26T23:38:43.925849Z 0 [Note] InnoDB: Initializing buffer pool, total size = 1G, instances = 8, chunk size = 128M
2019-09-26T23:38:43.946744Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-09-26T23:38:43.955252Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-09-26T23:38:43.966654Z 0 [Note] InnoDB: Recovering partial pages from the parallel doublewrite buffer at /var/lib/mysql/xb_doublewrite
2019-09-26T23:38:44.033822Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2019-09-26T23:38:44.033986Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2019-09-26T23:38:44.034023Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2019-09-26T23:38:44.034040Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-09-26T23:38:45.135220Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-09-26T23:38:45.135270Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-09-26T23:38:45.135283Z 0 [ERROR] Failed to initialize builtin plugins.
2019-09-26T23:38:45.135291Z 0 [ERROR] Aborting
2019-09-26T23:38:45.135301Z 0 [Note] Binlog end
2019-09-26T23:38:45.135371Z 0 [Note] Shutting down plugin 'CSV'
2019-09-26T23:38:45.136207Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
Is there anyone using this image ever getting this kind of error?
Update
It seems like mysql doesn't have the access to a particular file(s) or directory(ies), but I'm not sure which file(s) or directory(ies) . Here is the permission of mysql data directory:
clp#magento2dev:/$ ls -la /var/lib | grep mysql
drwxr-x--- 1 mysql mysql 4096 Sep 26 23:38 mysql
drwxrwx--- 2 mysql mysql 4096 Jul 11 15:24 mysql-files
drwxr-x--- 2 mysql mysql 4096 Jul 11 15:24 mysql-keyring

Can no longer run mysql with homebrew

I had mysql running fine on my Mac running High Sierra, 10.13.5. Last night, however, the system rebooted in the middle of the night for some unknown reason and I haven't been able to get things back and running properly since.
When I run brew services start mysql I get:
Successfully startedmysql(label: homebrew.mxcl.mysql)
in response. However, ps aux | grep mysql shows no running server and I cannot log into mysql. If I run, mysql.server start I get:
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/iMac-5K-3.local.pid).
The error file contents are as follows:
2018-06-18T13:51:57.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/iMac-5K-3.local.pid ended
2018-06-18T13:52:07.6NZ mysqld_safe Logging to '/usr/local/var/mysql/iMac-5K-3.local.err'.
2018-06-18T13:52:07.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2018-06-18T13:52:07.837840Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-06-18T13:52:07.838096Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2018-06-18T13:52:07.838155Z 0 [Note] /usr/local/opt/mysql/bin/mysqld (mysqld 5.7.22) starting as process 8334 ...
2018-06-18T13:52:07.840681Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2018-06-18T13:52:07.841958Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-18T13:52:07.841975Z 0 [Note] InnoDB: Uses event mutexes
2018-06-18T13:52:07.841983Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-06-18T13:52:07.841990Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-06-18T13:52:07.842257Z 0 [Note] InnoDB: Number of pools: 1
2018-06-18T13:52:07.842356Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-06-18T13:52:07.843494Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-06-18T13:52:07.852043Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-06-18T13:52:07.901671Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-06-18T13:52:07.902006Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 2700829144 and the end 2700828672.
2018-06-18T13:52:07.902049Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2018-06-18T13:52:08.338717Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2018-06-18T13:52:08.338812Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-06-18T13:52:08.338823Z 0 [ERROR] Failed to initialize builtin plugins.
2018-06-18T13:52:08.338835Z 0 [ERROR] Aborting
2018-06-18T13:52:08.338849Z 0 [Note] Binlog end
2018-06-18T13:52:08.338929Z 0 [Note] Shutting down plugin 'CSV'
2018-06-18T13:52:08.339077Z 0 [Note] /usr/local/opt/mysql/bin/mysqld: Shutdown complete
2018-06-18T13:52:08.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/iMac-5K-3.local.pid ended
OK, found the solution here.
I didn't bother with step 1 since I don't have a master/slave setup. I just did:
mv /var/lib/mysql/ib_logfile* ~
I can now start mysql successfully.