MariaDB doesn't connect to galera cluster despite reading configuration file - mysql

I'm trying to setup a galera cluster using MariaDB 10.6.11. It's something I've done several times without any problems, now I'm trying to automate the process and something weird happens.
I have a configuration file /etc/my.cnf.d/galera.cnf like this on every node:
[mysqld]
datadir=/var/lib/mysql
[galera]
# Mandatory settings
wsrep_on=ON
wsrep_provider="/usr/lib64/galera-4/libgalera_smm.so"
wsrep_provider_options="gcache.size=300M; gcache.page_size=200M"
wsrep_cluster_name="test"
wsrep_cluster_address="gcomm://192.168.1.176,192.168.1.61"
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
wsrep_sst_method=mariabackup
wsrep_sst_auth="backup:[redacted]"
# Log Options
wsrep_log_conflicts=ON
wsrep_provider_options="cert.log_conflicts=ON"
# Optional setting
#wsrep_slave_threads=1
innodb_flush_log_at_trx_commit=0
# Node Specific
wsrep_node_name="node-1"
bind-address="192.168.1.61"
Of course, in the other nodes bind-address and wsrep_node_name are set accordingly.
Anyway, I start the first node with
galera_new_cluster
And the cluster is started correctly, with one synced node as expected.
When I execute systemctl start mariadb on other node instead, after the first node is online, the second node starts in standalone mode, completely ignoring the galera configuration.
If I execute mariadbd --print-defaults on the second node, I see all the variables correctly set
[root#localhost ~]# mariadbd --print-defaults
mariadbd would have been started with the following arguments:
--datadir=/var/lib/mysql --wsrep_on=ON
--wsrep_provider=/usr/lib64/galera-4/libgalera_smm.so --wsrep_provider_options=gcache.size=300M; gcache.page_size=200M
--wsrep_cluster_name=test --wsrep_cluster_address=gcomm://192.168.1.176,192.168.1.61 --binlog_format=row --default_storage_engine=InnoDB
--innodb_autoinc_lock_mode=2 --wsrep_sst_method=mariabackup
--wsrep_sst_auth=backup:[redacted] --wsrep_log_conflicts=ON --wsrep_provider_options=cert.log_conflicts=ON
--innodb_flush_log_at_trx_commit=0 --wsrep_node_name=node-2 --bind-address=192.168.1.176
No attempt to join the cluster is made, it just starts as a standalone node.
From journactl:
2022-11-29 9:15:46 0 [Note] /usr/sbin/mariadbd (server 10.6.11-MariaDB) starting as process 5411 ...
2022-11-29 9:15:46 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-11-29 9:15:46 0 [Note] InnoDB: Number of pools: 1
2022-11-29 9:15:46 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2022-11-29 9:15:46 0 [Note] InnoDB: Using Linux native AIO
2022-11-29 9:15:46 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2022-11-29 9:15:46 0 [Note] InnoDB: Completed initialization of buffer pool
2022-11-29 9:15:46 0 [Note] InnoDB: 128 rollback segments are active.
2022-11-29 9:15:46 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-11-29 9:15:46 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-11-29 9:15:46 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2022-11-29 9:15:46 0 [Note] InnoDB: 10.6.11 started; log sequence number 50748; transaction id 29
2022-11-29 9:15:46 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-11-29 9:15:46 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2022-11-29 9:15:46 0 [Note] Server socket created on IP: '0.0.0.0'.
2022-11-29 9:15:46 0 [Note] Server socket created on IP: '::'.
2022-11-29 9:15:46 0 [Note] InnoDB: Buffer pool(s) load completed at 221129 9:15:46
2022-11-29 9:15:46 0 [Note] /usr/sbin/mariadbd: ready for connections.
Version: '10.6.11-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server
Started MariaDB 10.6.11 database server.
In /etc/my.cnf I have the line
!includedir /etc/my.cnf.d
so that's covered.
Communication between the two nodes is also ok, I opened every needed port. Also, if it were to be something about communication, I'd receive a timeout error or something.
Also, if I move the galera configuration to /etc/my.cnf.d/server.cnf, it works.
I'm confused. The variables are set correctly, what could it be?
One argument could be that in server.cnf there is an empty [galera] section, but I have it also on the first node and everything works there. Plus, again, the variables are set, so it's not like that empty section is overwriting my configuration.
Ideas?

Related

I see some warnings in mysql part of apache docker installation

I installed php:8.0.9-apache under docker and checking logs after installation I see some
warnings in mysql part :
2021-10-15 14:48:59+03:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.35-1debian10 started.
2021-10-15 14:49:00+03:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-10-15 14:49:00+03:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.35-1debian10 started.
2021-10-15T11:49:00.429892Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-10-15T11:49:00.432747Z 0 [Note] mysqld (mysqld 5.7.35) starting as process 1 ...
2021-10-15T11:49:00.437047Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-10-15T11:49:00.437068Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-10-15T11:49:00.437072Z 0 [Note] InnoDB: Uses event mutexes
2021-10-15T11:49:00.437077Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-10-15T11:49:00.437081Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-10-15T11:49:00.437085Z 0 [Note] InnoDB: Using Linux native AIO
2021-10-15T11:49:00.437330Z 0 [Note] InnoDB: Number of pools: 1
2021-10-15T11:49:00.437445Z 0 [Note] InnoDB: Using CPU crc32 instructions
2021-10-15T11:49:00.439834Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2021-10-15T11:49:00.451513Z 0 [Note] InnoDB: Completed initialization of buffer pool
2021-10-15T11:49:00.454482Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-10-15T11:49:00.473993Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2021-10-15T11:49:00.511954Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-10-15T11:49:00.513212Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-10-15T11:49:00.679673Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-10-15T11:49:00.681160Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2021-10-15T11:49:00.681185Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2021-10-15T11:49:00.681582Z 0 [Note] InnoDB: Waiting for purge to start
2021-10-15T11:49:00.732209Z 0 [Note] InnoDB: 5.7.35 started; log sequence number 12659641
2021-10-15T11:49:00.734197Z 0 [Note] Plugin 'FEDERATED' is disabled.
2021-10-15T11:49:00.737074Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-10-15T11:49:00.744353Z 0 [Warning] World-writable config file './auto.cnf' is ignored.
2021-10-15T11:49:00.746941Z 0 [Warning] World-writable config file './auto.cnf' has been removed.
2021-10-15T11:49:00.747343Z 0 [Note] Salting uuid generator variables, current_pid: 1, server_start_time: 1634298540, bytes_sent: 0,
2021-10-15T11:49:00.747433Z 0 [Note] Generated uuid: 'e3496a7a-2dad-11ec-9925-0242ac160002', server_start_time: 281476611009197, bytes_sent: 94189482984608
2021-10-15T11:49:00.747464Z 0 [Warning] 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: e3496a7a-2dad-11ec-9925-0242ac160002.
2021-10-15T11:49:00.777304Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2021-10-15T11:49:00.777328Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2021-10-15T11:49:00.777334Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2021-10-15T11:49:00.777336Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2021-10-15T11:49:00.781639Z 0 [Warning] CA certificate ca.pem is self signed.
2021-10-15T11:49:00.781737Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2021-10-15T11:49:00.782643Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2021-10-15T11:49:00.782677Z 0 [Note] IPv6 is available.
2021-10-15T11:49:00.782690Z 0 [Note] - '::' resolves to '::';
2021-10-15T11:49:00.782702Z 0 [Note] Server socket created on IP: '::'.
2021-10-15T11:49:00.793751Z 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.
2021-10-15T11:49:00.800000Z 0 [Note] InnoDB: Buffer pool(s) load completed at 211015 14:49:00
2021-10-15T11:49:00.853789Z 0 [Note] Event Scheduler: Loaded 0 events
2021-10-15T11:49:00.854072Z 0 [Note] mysqld: ready for connections.
Version: '5.7.35' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
In docker-compose.yml I have :
mysql_db:
container_name: Hostels4J_db
image: mysql:5.7.35
restart: always
environment:
- MYSQL_DATABASE=dbname
- MYSQL_USER=user
- MYSQL_PASSWORD=321
- MYSQL_ALLOW_EMPTY_PASSWORD=false
- MYSQL_ROOT_PASSWORD=321
Testing how app works these warnings seems not critical, but I am not sure have I try to fix them
or I can I get rid of them? I would like to see my logs as clear as possible...
MODIFIED # 1 :
But where have I to change the file permissions ?
In the docker-compose.ymlfile I have :
mysql_db:
container_name: Hostels4J_db
image: mysql:5.7.35
# image: mysql:8.0.21
restart: always
environment:
- MYSQL_DATABASE=DockerHostels4J
- MYSQL_USER=docker_user
- MYSQL_PASSWORD=4321
- MYSQL_ALLOW_EMPTY_PASSWORD=false
- MYSQL_ROOT_PASSWORD=321
volumes:
- ${DB_PATH_HOST}:/var/lib/mysql
and in Dockerfile.yml :
RUN docker-php-ext-install pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif \
&& a2enmod rewrite
These are all mysql options I have...
Thanks in advance!
Inside the mysql container image there seems to be a file auto.cnf that is world writable. Maybe the file permissions are set to 777? Reduce these permissions before running the container.
This is usually done at build-time using docker build ... and some Dockerfile.
MODIFIED 1:
In your dockerfile you will like to have something like
RUN chmod <less access privileges> <full path to auto.cnf>
To verify when running docker build, you could use
RUN ls -l <full path to auto.cnf>
Since your log output above only gives a relative path I cannot tell where exactly to find that file. But you could again use
RUN find / -name auto.cnf
There is one exception actually: if you happen to find the file inside the container in /var/lib/mysql, then actually it got mapped in there as external filesystem. In that case find the file in the hosts filesystem location, reduce the permissions and do not worry about the Dockerfile any more.

Galera Mysql wsrep_cluster_status stays Disconnected

My cluster was previously running, I have made these config changes and now Galera cluster bootstrap is not working.
I tried bootstraping with /usr/bin/mysqld_bootstrap as well as service mysql start --wsrep-new-cluster . but no luck.
mysql> SHOW GLOBAL STATUS WHERE Variable_name IN ('wsrep_ready', 'wsrep_cluster_size', 'wsrep_cluster_status', 'wsrep_connected');
+----------------------+--------------+
| Variable_name | Value |
+----------------------+--------------+
| wsrep_cluster_size | 0 |
| wsrep_cluster_status | Disconnected |
| wsrep_connected | OFF |
| wsrep_ready | ON |
+----------------------+--------------+
4 rows in set (0.00 sec)
root#hostname:/var/lib/mysql# cat /etc/my.cnf
[mysqld]
# character set
character_set_server = utf8
collation_server = utf8_general_ci
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
binlog_format=ROW
# Galera Cluster Configuration
wsrep_node_address="ip"
wsrep_node_name="hostname"
wsrep_cluster_name="mysql_cluster"
wsrep_cluster_address="gcomm://"
wsrep_provider_options = "gcache.size = 16G; gcache.recover = yes; gmcast.segment=0; gmcast.time_wait=PT5S; cert.log_conflicts=ON;"
wsrep_retry_autocommit=5
wsrep_slave_threads=64
wsrep_log_conflicts=ON
wsrep_provider=/usr/lib/libgalera_smm.so
wsrep_sst_method=rsync # Galera Synchronization Configuration
# wsrep_certify_nonPK=1 # make sure primary key is present in a DB
# Mysql configurations
default_storage_engine=innodb
innodb_autoinc_lock_mode=2
innodb_flush_log_at_trx_commit=2
innodb_buffer_pool_size=20G # 80% of total memory
table_open_cache=8192
max_connections=500
innodb_buffer_pool_instances=40
thread_cache_size=128
max_allowed_packet=16M
thread_stack=192K
[mysql_safe]
log-error=/var/log/mysql/error.log
pid-file=/var/run/mysqld/mysqld.pid
#include mysql config
!includedir /etc/mysql/conf.d/
error.log
2020-05-10T14:52:11.510387Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-05-10T14:52:11.512408Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.29-log) starting as process 38762 ...
2020-05-10T14:52:11.516208Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-05-10T14:52:11.516233Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-05-10T14:52:11.516240Z 0 [Note] InnoDB: Uses event mutexes
2020-05-10T14:52:11.516246Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-05-10T14:52:11.516251Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-05-10T14:52:11.516259Z 0 [Note] InnoDB: Using Linux native AIO
2020-05-10T14:52:11.516566Z 0 [Note] InnoDB: Number of pools: 1
2020-05-10T14:52:11.516689Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-05-10T14:52:11.518701Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-05-10T14:52:11.528085Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-05-10T14:52:11.530536Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-05-10T14:52:11.542537Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-05-10T14:52:11.559072Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-05-10T14:52:11.559138Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-05-10T14:52:11.601120Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-05-10T14:52:11.602357Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-05-10T14:52:11.602377Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-05-10T14:52:11.602854Z 0 [Note] InnoDB: Waiting for purge to start
2020-05-10T14:52:11.653077Z 0 [Note] InnoDB: 5.7.29 started; log sequence number 3779657135
2020-05-10T14:52:11.653388Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-05-10T14:52:11.653670Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-05-10T14:52:11.656614Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200510 7:52:11
2020-05-10T14:52:11.665175Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2020-05-10T14:52:11.665203Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2020-05-10T14:52:11.666274Z 0 [Warning] CA certificate ca.pem is self signed.
2020-05-10T14:52:11.666344Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2020-05-10T14:52:11.667341Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2020-05-10T14:52:11.667427Z 0 [Note] IPv6 is available.
2020-05-10T14:52:11.667444Z 0 [Note] - '::' resolves to '::';
2020-05-10T14:52:11.667487Z 0 [Note] Server socket created on IP: '::'.
2020-05-10T14:52:11.686718Z 0 [Note] Event Scheduler: Loaded 0 events
2020-05-10T14:52:11.686771Z 0 [Note] WSREP: Initial position: 00000000-0000-0000-b0f1-bf0300000000:62901600
2020-05-10T14:52:11.686784Z 0 [Warning] WSREP: Initial position was provided by configuration or SST, avoiding override
2020-05-10T14:52:11.686792Z 0 [Note] WSREP: wsrep_load(): loading provider library 'none'
2020-05-10T14:52:11.687082Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.29-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Wsrep Server (GPL), wsrep_25.21
2020-05-10T14:52:12.732431Z 2 [Note] Access denied for user 'root'#'localhost' (using password: NO)
2020-05-10T14:57:11.957879Z 4 [Note] WSREP: Stop replication
2020-05-10T14:57:11.957918Z 4 [Note] Giving 1 client threads a chance to die gracefully
Make sure it belongs to mysql user and mysql group
chown mysql:mysql /etc/my.cnf
Also, and very important, make sure the library is in /etc/my.cnf
symbolic-links=0
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
The file /etc/my.cnf was missing read permissions. This file requires read permission for mysql user. I have set the permission to 755 and Galera configuration was loaded properly.
chmod 775 /etc/my.cnf

MAMP SQLSTATE[HY000] [2006] MySQL server has gone away on Mac Catalina

I googled and the solution was to add/edit this:
[mysqld]
wait_timeout=100000
max_allowed_packet = 256M
into this file /etc/mysql/my.cnf and but i cant find etc, where is the etc?
mysql_error_log.err
2020-02-26T13:09:54.6NZ mysqld_safe Logging to
'/Applications/MAMP/logs/mysql_error_log.err'. 2020-02-26T13:09:54.6NZ
mysqld_safe Starting mysqld daemon with databases from
/Applications/MAMP/db/mysql57 2020-02-26T13:09:54.943202Z 0 [Warning]
TIMESTAMP with implicit DEFAULT value is deprecated. Please use
--explicit_defaults_for_timestamp server option (see documentation for more details). 2020-02-26T13:09:54.943551Z 0 [Note] --secure-file-priv
is set to NULL. Operations related to importing and exporting data are
disabled 2020-02-26T13:09:54.943611Z 0 [Note]
/Applications/MAMP/Library/bin/mysqld (mysqld 5.7.26) starting as
process 2189 ... 2020-02-26T13:09:54.949688Z 0 [Warning] Setting
lower_case_table_names=2 because file system for
/Applications/MAMP/db/mysql57/ is case insensitive
2020-02-26T13:09:54.952118Z 0 [Note] InnoDB: Mutexes and rw_locks use
GCC atomic builtins 2020-02-26T13:09:54.952159Z 0 [Note] InnoDB: Uses
event mutexes 2020-02-26T13:09:54.952176Z 0 [Note] InnoDB: GCC builtin
__atomic_thread_fence() is used for memory barrier 2020-02-26T13:09:54.952187Z 0 [Note] InnoDB: Compressed tables use
zlib 1.2.11 2020-02-26T13:09:54.952681Z 0 [Note] InnoDB: Number of
pools: 1 2020-02-26T13:09:54.952894Z 0 [Note] InnoDB: Using CPU crc32
instructions 2020-02-26T13:09:54.955089Z 0 [Note] InnoDB: Initializing
buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-02-26T13:09:54.971785Z 0 [Note] InnoDB: Completed initialization
of buffer pool 2020-02-26T13:09:54.990800Z 0 [Note] InnoDB: Highest
supported file format is Barracuda. 2020-02-26T13:09:55.005564Z 0
[Note] InnoDB: Creating shared tablespace for temporary tables
2020-02-26T13:09:55.005739Z 0 [Note] InnoDB: Setting file './ibtmp1'
size to 12 MB. Physically writing the file full; Please wait ...
2020-02-26T13:09:55.024819Z 0 [Note] InnoDB: File './ibtmp1' size is
now 12 MB. 2020-02-26T13:09:55.025655Z 0 [Note] InnoDB: 96 redo
rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-02-26T13:09:55.025678Z 0 [Note] InnoDB: 32 non-redo rollback
segment(s) are active. 2020-02-26T13:09:55.025883Z 0 [Note] InnoDB:
Waiting for purge to start 2020-02-26T13:09:55.079934Z 0 [Note]
InnoDB: 5.7.26 started; log sequence number 2551871
2020-02-26T13:09:55.080171Z 0 [Note] InnoDB: Loading buffer pool(s)
from /Applications/MAMP/db/mysql57/ib_buffer_pool
2020-02-26T13:09:55.080257Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-02-26T13:09:55.086927Z 0 [Warning] InnoDB: Table
mysql/innodb_table_stats has length mismatch in the column name
table_name. Please run mysql_upgrade 2020-02-26T13:09:55.086990Z 0
[Warning] InnoDB: Table mysql/innodb_index_stats has length mismatch
in the column name table_name. Please run mysql_upgrade
2020-02-26T13:09:55.090242Z 0 [Warning] Failed to set up SSL because
of the following SSL library error: SSL context is not usable without
certificate and private key 2020-02-26T13:09:55.090273Z 0 [Note]
Server hostname (bind-address): '*'; port: 3306
2020-02-26T13:09:55.090660Z 0 [Note] IPv6 is available.
2020-02-26T13:09:55.090721Z 0 [Note] - '::' resolves to '::';
2020-02-26T13:09:55.090868Z 0 [Note] Server socket created on IP:
'::'. 2020-02-26T13:09:55.093848Z 0 [Note] InnoDB: Buffer pool(s) load
completed at 200226 21:09:55 2020-02-26T13:09:55.173772Z 0 [Note]
Event Scheduler: Loaded 0 events 2020-02-26T13:09:55.173947Z 0 [Note]
/Applications/MAMP/Library/bin/mysqld: ready for connections. Version:
'5.7.26' socket: '/Applications/MAMP/tmp/mysql/mysql.sock' port:
3306 MySQL Community Server (GPL) 2020-02-26T13:10:18.977842Z 2
[Note] Got an error reading communication packets
You're using MAMP so you will need to create a new file in /Applications/MAMP/conf/ called my.conf
Your full file path will be /Applications/MAMP/conf/my.conf and the contents will be:
[mysqld]
wait_timeout=100000
max_allowed_packet = 256M
Once you've added the file you probably need to restart your mysql server in MAMP

MySql startup error ' ERROR! The server quit without updating PID file'

I have tried every link that is on S.O but still getting the same outcome every time I try to start MySQL. Following is the log from the .err file.
2018-01-07T06:58:11.729500Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2018-01-07T06:58:11.731659Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-01-07T06:58:11.731673Z 0 [Note] InnoDB: Uses event mutexes
2018-01-07T06:58:11.731679Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-01-07T06:58:11.731682Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-01-07T06:58:11.731969Z 0 [Note] InnoDB: Number of pools: 1
2018-01-07T06:58:11.732068Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-01-07T06:58:11.733672Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-01-07T06:58:11.745339Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-01-07T06:58:11.761905Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-01-07T06:58:11.906535Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-01-07T06:58:11.906692Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-01-07T06:58:11.918639Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-01-07T06:58:11.919925Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-01-07T06:58:11.919938Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-01-07T06:58:11.920116Z 0 [Note] InnoDB: Waiting for purge to start
2018-01-07T06:58:11.974340Z 0 [Note] InnoDB: 5.7.20 started; log sequence number 129183358
2018-01-07T06:58:11.974571Z 0 [Note] InnoDB: Loading buffer pool(s) from /usr/local/var/mysql/ib_buffer_pool
2018-01-07T06:58:11.974744Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-01-07T06:58:11.974853Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180107 12:28:11
2018-01-07T06:58:11.983233Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2018-01-07T06:58:11.983254Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2018-01-07T06:58:11.983981Z 0 [Warning] CA certificate ca.pem is self signed.
2018-01-07T06:58:11.984032Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2018-01-07T06:58:11.989041Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2018-01-07T06:58:11.989070Z 0 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2018-01-07T06:58:11.989136Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2018-01-07T06:58:11.989166Z 0 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
2018-01-07T06:58:11.989169Z 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2018-01-07T06:58:11.989199Z 0 [ERROR] Aborting
It looks like you have some other software that is using the port 3306. MySQL uses this port, but it's failing to bind to it because it is in use. End the other software and try to launch MySQL again.
If you need to have the other software running at the same time with MySQL, you have to change the default port in one of them to some other unused port.
To change the port in MySQL. If you're on Windows, find the my.ini file for MySQL installation, open this file in a text editor and look for this section:
# The TCP/IP Port the MySQL Server will listen on
port=3306
Then change the number of the port, save the file, and restart the MySQL service.

MySQL won't start on Linux

I have a fresh mysql-server install (installed via yum) that will not start
bash-4.1# /sbin/service mysqld start
MySQL Daemon failed to start.
Starting mysqld: [FAILED]
The /etc/my.cnf has been set to default:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
The error I receive is:
2016-02-16T22:47:18.453320Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2016-02-16T22:47:18.888497Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-02-16T22:47:18.889955Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.11) starting as process 4321 ...
2016-02-16T22:47:19.016515Z 0 [Note] InnoDB: PUNCH HOLE support available
2016-02-16T22:47:19.016568Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-02-16T22:47:19.016583Z 0 [Note] InnoDB: Uses event mutexes
2016-02-16T22:47:19.016596Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2016-02-16T22:47:19.016609Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-02-16T22:47:19.016631Z 0 [Note] InnoDB: Using Linux native AIO
2016-02-16T22:47:19.018127Z 0 [Note] InnoDB: Number of pools: 1
2016-02-16T22:47:19.018819Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-02-16T22:47:19.052517Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-02-16T22:47:19.071855Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-02-16T22:47:19.078235Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2016-02-16T22:47:19.092945Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2016-02-16T22:47:19.107542Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2016-02-16T22:47:19.107588Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2016-02-16T22:47:19.160738Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2016-02-16T22:47:19.163712Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2016-02-16T22:47:19.163748Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2016-02-16T22:47:19.165210Z 0 [Note] InnoDB: Waiting for purge to start
2016-02-16T22:47:19.215586Z 0 [Note] InnoDB: 5.7.11 started; log sequence number 1210437
2016-02-16T22:47:19.216328Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2016-02-16T22:47:19.217459Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-02-16T22:47:19.217537Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160216 22:47:19
mysqld: Table 'mysql.plugin' doesn't exist
2016-02-16T22:47:19.217905Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2016-02-16T22:47:19.219399Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-02-16T22:47:19.219650Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2016-02-16T22:47:19.220055Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2016-02-16T22:47:19.220231Z 0 [Note] IPv6 is available.
2016-02-16T22:47:19.220261Z 0 [Note] - '::' resolves to '::';
2016-02-16T22:47:19.220280Z 0 [Note] Server socket created on IP: '::'.
2016-02-16T22:47:19.233206Z 0 [Warning] Failed to open optimizer cost constant tables
2016-02-16T22:47:19.233439Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2016-02-16T22:47:19.233551Z 0 [ERROR] Aborting
However, I can't run mysql_upgrade as mysqld isn't running. Other sites have stated that file permissions of the data files could be an issue, but they are all owned by mysql (i.e. I believe correct). I've also tried running mysqld_safe, but without success.
Can someone please suggest what I've done wrong?
Thanks Mark.
mysql_install_db didn't work (was deprecated, and then the suggested initialise failed). However, a complete clean and reinstall resolved the issue.
For reference, the exact steps I performed were:
yum remove mysql
rm -fr /usr/bin/mysql
rm -fr /var/lib/mysql
rm -fr /etc/my*
(reboot)
yum install mysql-community-{server,client,common,libs}-*
/sbin/service mysqld start