Mysql status fails every few hours, I also checked the buffer size, no problem with them and
The following message is displayed with the below command:
systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Wed 2020-12-02 17:05:42 EST; 8h ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 25565 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 25543 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 17582 (code=killed, signal=KILL)
Dec 02 17:05:42 test.local systemd[1]: Failed to start MySQL Server.
Dec 02 17:05:42 test.local systemd[1]: Unit mysqld.service entered failed state.
Dec 02 17:05:42 test.local systemd[1]: mysqld.service failed.
Dec 02 17:05:42 test.local systemd[1]: mysqld.service holdoff time over, scheduling restart.
Dec 02 17:05:42 test.local systemd[1]: Stopped MySQL Server.
Dec 02 17:05:42 test.local systemd[1]: start request repeated too quickly for mysqld.service
Dec 02 17:05:42 test.local systemd[1]: Failed to start MySQL Server.
Dec 02 17:05:42 test.local systemd[1]: Unit mysqld.service entered failed state.
Dec 02 17:05:42 test.local systemd[1]: mysqld.service failed.
I also checked the log file and the following event occurred:
2020-12-02T22:05:42.179677Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation $2020-12-02T22:05:42.184072Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.31) starting as process 25570 ...
2020-12-02T22:05:42.204497Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-12-02T22:05:42.204557Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-12-02T22:05:42.204565Z 0 [Note] InnoDB: Uses event mutexes
2020-12-02T22:05:42.204574Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-12-02T22:05:42.204579Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-12-02T22:05:42.204584Z 0 [Note] InnoDB: Using Linux native AIO
2020-12-02T22:05:42.204998Z 0 [Note] InnoDB: Number of pools: 1
2020-12-02T22:05:42.205184Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-12-02T22:05:42.208098Z 0 [Note] InnoDB: Initializing buffer pool, total size = 6G, instances = 8, chunk size = 128M
2020-12-02T22:05:42.443914Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2020-12-02T22:05:42.510301Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2020-12-02T22:05:42.510359Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2020-12-02T22:05:42.510376Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-12-02T22:05:42.510384Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-12-02T22:05:42.510391Z 0 [ERROR] Failed to initialize builtin plugins.
2020-12-02T22:05:42.510399Z 0 [ERROR] Aborting
2020-12-02T22:05:42.510438Z 0 [Note] Binlog end
2020-12-02T22:05:42.510525Z 0 [Note] Shutting down plugin 'CSV'
2020-12-02T22:05:42.511922Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
also My.cf file:
[mysqld]
datadir = /var/lib/mysql
socket = /var/lib/mysql/mysql.sock
symbolic-links=0
innodb_file_per_table = 1
myisam_sort_buffer_size = 64M
read_rnd_buffer_size = 1024K
net_buffer_length = 8K
read_buffer_size = 1024K
sort_buffer_size = 1024K
table_open_cache = 64
max_allowed_packet = 2M
key_buffer_size = 64M
innodb_buffer_pool_size = 6024M
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
I tested this project on a server with 2 GB of RAM, but it failed on a server with 8 GB of RAM.
Consider these changes to your my.cnf [mysqld] section
innodb_buffer_pool_size=4G
and REMOVE to allow defaults to work for improved performance
read_rnd_buffer_size
read_buffer_size
sort_buffer_size
to reduce RAM footprint.
For additional suggestions, view my profile, Network profile for contact info and free downloadable Utility Scripts to assist with performance tuning.
Related
I would like to install MySQL5.7 to my amazon linux in some way.
However I do not know that It is possible to install mysql5.7 in Amazon-linux.
Originally in my EC2 , Maria DB was set as default.
I did these steps.
But it did not start.
$ sudo yum install -y
$ yum list installed | grep mysql
$ sudo yum-config-manager --disable mysql80-community
$ sudo yum-config-manager --enable mysql57-community
$ yum repolist all | grep -E "mysql[0-9]+-community/x86"
$ sudo yum install -y mysql-community-server
Loaded :extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 3.7 kB 00:00:00
385 packages excluded due to repository priority protections
Package mysql-community-server-5.7.36-1.el7.x86_64 is the latest version.
$ sudo systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
$ systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Fri 2021-12-10 20:52:34 JST; 26s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 32505 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 32484 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
12- 10 20:52:34 ip-172-91-96-191.ap-northeast-1.compute.internal systemd[1]: mysqld.service: control process exited, code=exited status=1
12- 10 20:52:34 ip-172-91-96-191.ap-northeast-1.compute.internal systemd[1]: Failed to start MySQL Server.
12- 10 20:52:34 ip-172-91-96-191.ap-northeast-1.compute.internal systemd[1]: Unit mysqld.service entered failed state.
12- 10 20:52:34 ip-172-91-96-191.ap-northeast-1.compute.internal systemd[1]: mysqld.service failed.
12- 10 20:52:34 ip-172-91-96-191.ap-northeast-1.compute.internal systemd[1]: mysqld.service holdoff time over, scheduling restart.
12- 10 20:52:34 ip-172-91-96-191.ap-northeast-1.compute.internal systemd[1]: start request repeated too quickly for mysqld.service
12- 10 20:52:34 ip-172-91-96-191.ap-northeast-1.compute.internal systemd[1]: Failed to start MySQL Server.
12- 10 20:52:34 ip-172-91-96-191.ap-northeast-1.compute.internal systemd[1]: Unit mysqld.service entered failed state.
12- 10 20:52:34 ip-172-91-96-191.ap-northeast-1.compute.internal systemd[1]: mysqld.service failed.
I also did these steps.
I tried look up the way as far I can.
https://aws.amazon.com/amazon-linux-2/
$ /etc/init.d/mysql stop
-bash: /etc/init.d/mysql: No such file or directory
$ service mysql stop
Redirecting to /bin/systemctl stop mysql.service
Failed to stop mysql.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files
See system logs and 'systemctl status mysql.service' for details.
$ killall -KILL mysql mysqld_safe mysqld
mysql: no process found
mysqld_safe: no process found
mysqld: no process found
$ /etc/init.d/mysql start
-bash: /etc/init.d/mysql: No such file or directory
$ sudo systemctl stop mysqld
$ sudo systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
$ sudo cat /var/log/mysqld.log
Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0 thread_stack 0x40000
/usr/sbin/mysqld(my_print_stacktrace+0x3b)[0xf525bb]
/usr/sbin/mysqld(handle_fatal_signal+0x486)[0x7e3f06]
/lib64/libpthread.so.0(+0x117e0)[0x7f0dc34517e0]
/lib64/libc.so.6(gsignal+0x110)[0x7f0dc1da0c20]
/lib64/libc.so.6(abort+0x148)[0x7f0dc1da20c8]
/usr/sbin/mysqld[0x7b3eb0]
/usr/sbin/mysqld(_ZN2ib5fatalD1Ev+0xfd)[0x12882cd]
/usr/sbin/mysqld[0x133fce2]
/usr/sbin/mysqld[0x134022b]
/usr/sbin/mysqld(_Z6fil_ioRK9IORequestbRK9page_id_tRK11page_size_tmmPvS8_+0x208)[0x134baf8]
/usr/sbin/mysqld(_Z13buf_read_pageRK9page_id_tRK11page_size_t+0xe4)[0x12f9d74]
/usr/sbin/mysqld(_Z16buf_page_get_genRK9page_id_tRK11page_size_tmP11buf_block_tmPKcmP5mtr_tb+0x42d)[0x12c916d]
/usr/sbin/mysqld(_Z31trx_rseg_get_n_undo_tablespacesPm+0x15d)[0x126742d]
/usr/sbin/mysqld[0x122f258]
/usr/sbin/mysqld(_Z34innobase_start_or_create_for_mysqlv+0x3996)[0x12339a6]
/usr/sbin/mysqld[0x10f8a2f]
/usr/sbin/mysqld(_Z24ha_initialize_handlertonP13st_plugin_int+0x51)[0x836df1]
/usr/sbin/mysqld[0xd35d35]
/usr/sbin/mysqld(_Z40plugin_register_builtin_and_init_core_sePiPPc+0x2f0)[0xd3c060]
/usr/sbin/mysqld[0x7dc3e4]
/usr/sbin/mysqld(_Z11mysqld_mainiPPc+0xa85)[0x7dfc05]
/lib64/libc.so.6(__libc_start_main+0xea)[0x7f0dc1d8e0ba]
/usr/sbin/mysqld[0x7d3864]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
2021-12-10T12:20:30.164676Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-12-10T12:20:30.171606Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.36) starting as process 1117 ...
2021-12-10T12:20:30.192632Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-12-10T12:20:30.192667Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-12-10T12:20:30.192671Z 0 [Note] InnoDB: Uses event mutexes
2021-12-10T12:20:30.192675Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-12-10T12:20:30.192678Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-12-10T12:20:30.192681Z 0 [Note] InnoDB: Using Linux native AIO
2021-12-10T12:20:30.192972Z 0 [Note] InnoDB: Number of pools: 1
2021-12-10T12:20:30.193097Z 0 [Note] InnoDB: Using CPU crc32 instructions
2021-12-10T12:20:30.203486Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2021-12-10T12:20:30.218799Z 0 [Note] InnoDB: Completed initialization of buffer pool
2021-12-10T12:20:30.224633Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-12-10T12:20:30.252634Z 0 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are 0x4000!
2021-12-10 21:20:30 0x7f9a7c57d740 InnoDB: Assertion failure in thread 140301487822656 in file ut0ut.cc line 921
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
12:20:30 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.
key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
MySql was operating normally and system had some problems,but start mysql with error after restarting servers.System version:CentOS Linux release 7.7.1908
How to resolve this?
this is log
[flink#master sbin]$ ./mysqld
2020-07-22 15:42:13 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-07-22 15:42:13 0 [Note] ./mysqld (mysqld 5.6.45) starting as process 6401 ...
2020-07-22 15:42:13 6401 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5010)
2020-07-22 15:42:13 6401 [Warning] Buffered warning: Changed limits: max_connections: 214 (requested 1000)
2020-07-22 15:42:13 6401 [Warning] Buffered warning: Changed limits: table_open_cache: 400 (requested 2000)
2020-07-22 15:42:13 6401 [Note] Plugin 'FEDERATED' is disabled.
./mysqld: Can't find file: './mysql/plugin.frm' (errno: 13 - Permission denied)
2020-07-22 15:42:13 6401 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2020-07-22 15:42:13 6401 [Note] InnoDB: Using atomics to ref count buffer pool pages
2020-07-22 15:42:13 6401 [Note] InnoDB: The InnoDB memory heap is disabled
2020-07-22 15:42:13 6401 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-07-22 15:42:13 6401 [Note] InnoDB: Memory barrier is not used
2020-07-22 15:42:13 6401 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-07-22 15:42:13 6401 [Note] InnoDB: Using Linux native AIO
2020-07-22 15:42:13 6401 [Note] InnoDB: Using CPU crc32 instructions
2020-07-22 15:42:13 6401 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2020-07-22 15:42:13 6401 [Note] InnoDB: Completed initialization of buffer pool
2020-07-22 15:42:13 6401 [Note] InnoDB: Highest supported file format is Barracuda.
2020-07-22 15:42:13 6401 [Note] InnoDB: 128 rollback segment(s) are active.
2020-07-22 15:42:13 6401 [Note] InnoDB: Waiting for purge to start
2020-07-22 15:42:13 6401 [Note] InnoDB: 5.6.45 started; log sequence number 1600627
2020-07-22 15:42:13 6401 [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: db5e3d0e-cbee-11ea-9
this is sql status after starting mysql
[flink#master mysql]$ systemctl status mysqld
● mysqld.service - MySQL Community Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: activating (start-post) (Result: exit-code) since Wed 2020-07-22 15:49:34 CST; 1min 5s ago
Process: 8318 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=1/FAILURE)
Process: 8303 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 8318 (code=exited, status=1/FAILURE); : 8319 (mysql-systemd-s)
Tasks: 2
Memory: 17.7M
CGroup: /system.slice/mysqld.service
└─control
├─8319 /bin/bash /usr/bin/mysql-systemd-start post
└─8817 sleep 1
Jul 22 15:49:34 master systemd[1]: Starting MySQL Community Server...
Jul 22 15:49:35 master mysqld_safe[8318]: 200722 15:49:35 mysqld_safe Logging to '/var/lib/mysql/mysqld.log'.
Jul 22 15:49:35 master mysqld_safe[8318]: /usr/bin/mysqld_safe: line 138: /var/lib/mysql/mysqld.log: Permission denied
Jul 22 15:49:35 master mysqld_safe[8318]: 200722 15:49:35 mysqld_safe Directory '/home/flink/hdd/mysql_data/mysql' for UNIX socket file... exists.
Jul 22 15:49:35 master systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE
Hint: Some lines were ellipsized, use -l to show in full.
So when i try to start mariadb this happens:
Job for mariadb.service failed because a timeout was exceeded.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
systemctl status mariadb.service shows this:
* mariadb.service - MariaDB database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: failed (Result: timeout) since Mon 2019-02-18 10:11:09 UTC; 4min 1s ago
Process: 779 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 692 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]
Process: 690 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 689 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Main PID: 779 (code=exited, status=0/SUCCESS)
Feb 18 10:09:36 vps-zap348646-1 systemd[1]: Starting MariaDB database server...
Feb 18 10:09:37 vps-zap348646-1 mysqld[779]: 2019-02-18 10:09:37 140439143227328 [Note] /usr/sbin/mysqld (mysqld 10.1.29-MariaDB-6ubuntu2) starting as process
Feb 18 10:11:07 vps-zap348646-1 systemd[1]: mariadb.service: Start operation timed out. Terminating.
Feb 18 10:11:09 vps-zap348646-1 systemd[1]: mariadb.service: Failed with result 'timeout'.
Feb 18 10:11:09 vps-zap348646-1 systemd[1]: Failed to start MariaDB database server.
journalctl -xe shows this:
Feb 18 10:17:09 vps-zap348646-1 systemd[1]: Starting MariaDB database server...
-- Subject: Unit mariadb.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mariadb.service has begun starting up.
Feb 18 10:17:10 vps-zap348646-1 mysqld[940]: 2019-02-18 10:17:10 139827003494336 [Note] /usr/sbin/mysqld (mysqld 10.1.29-MariaDB-6ubuntu2)
Feb 18 10:18:39 vps-zap348646-1 systemd[1]: mariadb.service: Start operation timed out. Terminating.
Feb 18 10:18:41 vps-zap348646-1 systemd[1]: mariadb.service: Failed with result 'timeout'.
Feb 18 10:18:41 vps-zap348646-1 systemd[1]: Failed to start MariaDB database server.
-- Subject: Unit mariadb.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mariadb.service has failed.
--
-- The result is RESULT.
And finally error.log in mysql:
2019-02-18 10:17:10 139827003494336 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2019-02-18 10:17:10 139827003494336 [Note] InnoDB: The InnoDB memory heap is disabled
2019-02-18 10:17:10 139827003494336 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-02-18 10:17:10 139827003494336 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-02-18 10:17:10 139827003494336 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-02-18 10:17:10 139827003494336 [Note] InnoDB: Using Linux native AIO
2019-02-18 10:17:10 139827003494336 [Note] InnoDB: Using SSE crc32 instructions
2019-02-18 10:17:10 139827003494336 [Note] InnoDB: Initializing buffer pool, size = 1.0G
2019-02-18 10:17:10 139827003494336 [Note] InnoDB: Completed initialization of buffer pool
2019-02-18 10:17:10 139827003494336 [Note] InnoDB: Highest supported file format is Barracuda.
2019-02-18 10:17:10 139827003494336 [Note] InnoDB: 128 rollback segment(s) are active.
2019-02-18 10:17:10 139827003494336 [Note] InnoDB: Waiting for purge to start
2019-02-18 10:17:10 139827003494336 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.36-82.2 started; log sequence number 103241 029
2019-02-18 10:17:10 139827003494336 [Note] Plugin 'FEEDBACK' is disabled.
2019-02-18 10:17:10 139825235617536 [Note] InnoDB: Dumping buffer pool(s) not yet started
2019-02-18 10:17:10 139827003494336 [Note] Server socket created on IP: '127.0.0.1'.
2019-02-18 10:17:10 139827003494336 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.1.29-MariaDB-6ubuntu2' socket: '/var/run/mysqld/mysqld.sock' port: 3306 Ubuntu 18.10
2019-02-18 10:18:39 139827002763008 [Note] /usr/sbin/mysqld: Normal shutdown
2019-02-18 10:18:39 139827002763008 [Note] Event Scheduler: Purging the queue. 0 events
2019-02-18 10:18:39 139825283266304 [Note] InnoDB: FTS optimize thread exiting.
2019-02-18 10:18:39 139827002763008 [Note] InnoDB: Starting shutdown...
2019-02-18 10:18:39 139827002763008 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2019-02-18 10:18:41 139827002763008 [Note] InnoDB: Shutdown completed; log sequence number 103241039
2019-02-18 10:18:41 139827002763008 [Note] /usr/sbin/mysqld: Shutdown complete
Either I am blind or there just isn't any error and mariadb is just not working.
Maybe one of you guys have an idea. Thanks.
Edit:
I found a "solution" for now, mariadb is shutting down because of a timeout when starting, so for now I set the timeout to 0. For now this solution is enough but there must be a real solution.
Please note that since 10.1.10, MariaDB uses systemd to start the service. The /etc/init.d/mysql script is no longer used, so MYSQLD_STARTUP_TIMEOUT has no effect.
You need to find your mariadb.service file. In our case, it did not contain a timeout so the MariaDB default was being used. Just add /etc/systemd/system/mariadb.service.d/override.conf file, and put in it:
[Service]
TimeoutStartSec = 0
In the [Service] section, and it will never time out. After create the file:
# systemctl daemon-reload
# systemctl restart mysql.service
The web application does not connect to the database on VDS (0.5 RAM, 1 core CPU). I can't understand the reason. I do not know what to do please tell me.
This is mysql configuration my.cnf. I included there innodb_buffer_pool_size = 250M
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
symbolic-links=0
max_connections=25
max_user_connections=20
wait_timeout=10
interactive_timeout=50
long_query_time=5
#log-queries-not-using-indexes
#log-slow-queries=/var/log/mysql/log-slow-queries.log
bind-address=185.231.154.57
#key_buffer = 16M
myisam_sort_buffer_size = 32M
join_buffer_size=1M
read_buffer_size=1M
sort_buffer_size=2M
#table_cache=1024
thread_cache_size=286
interactive_timeout=25
connect_timeout=5
max_allowed_packet=1M
max_connect_errors=1000
#query_cache_limit=1M
#query_cache_size=8M
#query_cache_type=1
tmp_table_size=16M
#innodb_use_native_aio = 0
innodb_buffer_pool_size = 250M
innodb_file_per_table
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
logs:
root#v101877:/home/servers/apache-tomee-plume-8.0.0-M1/binsystemctl status mysql
* mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2019-01-13 10:04:17 MSK; 10min ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 681 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 642 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 681 (code=exited, status=1/FAILURE)
Status: "SERVER_BOOTING"
Jan 13 10:04:17 v101877.hosted-by-vdsina.ru mysqld[681]: 2019-01-13T07:04:17.608676Z 0 [ERROR] [MY-012681] [InnoDB] mmap(137428992 bytes) failed; errno 12
Jan 13 10:04:17 v101877.hosted-by-vdsina.ru mysqld[681]: 2019-01-13T07:04:17.610517Z 1 [ERROR] [MY-012956] [InnoDB] Cannot allocate memory for the buffer pool
Jan 13 10:04:17 v101877.hosted-by-vdsina.ru mysqld[681]: 2019-01-13T07:04:17.610553Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
Jan 13 10:04:17 v101877.hosted-by-vdsina.ru mysqld[681]: 2019-01-13T07:04:17.611113Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
Jan 13 10:04:17 v101877.hosted-by-vdsina.ru mysqld[681]: 2019-01-13T07:04:17.612755Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
Jan 13 10:04:17 v101877.hosted-by-vdsina.ru mysqld[681]: 2019-01-13T07:04:17.613398Z 0 [ERROR] [MY-010119] [Server] Aborting
Jan 13 10:04:17 v101877.hosted-by-vdsina.ru mysqld[681]: 2019-01-13T07:04:17.626404Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.13) MySQL Community Server - GPL.
Jan 13 10:04:17 v101877.hosted-by-vdsina.ru systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Jan 13 10:04:17 v101877.hosted-by-vdsina.ru systemd[1]: mysql.service: Failed with result 'exit-code'.
Jan 13 10:04:17 v101877.hosted-by-vdsina.ru systemd[1]: Failed to start MySQL Community Server.
Suggestions to consider for your my.cnf [mysqld] section
# join_buffer_size=1M
# read_buffer_size=1M
# sort_buffer_size=2M
# table_cache=1024
# thread_cache_size=286
innodb_buffer_pool_size=10M
until you can get started. Yes, DISABLE all 5 of these lines so the DEFAULTS will allow you to get running.
If you have .5 G of RAM, expect FRUSTRATION. Very few people use less than 4 G of RAM at this point in time.
I'm using Vagrant with libvirt and I stumbled upon this error.
After hours of struggling, the problem has turned out to be the Vagrant configuration, instead of the mysql/mysqld one.
In the Vagrantfile I uncommented the option to customize the virtual machine's virtual RAM. The default was 512MB, with the 1024 value is working fine now:
config.vm.provider "libvirt" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# Customize the amount of memory on the VM:
vb.memory = "1024"
end
I hope it helps someone, I never had this error using Virtualbox, maybe it comes with a different default memory value out of the box.
Today at around 6:23 UTC my Ubuntu Server 16.04 in Amazon EC2 made an automated apt update. From around this time my MySql server refuses to start.
At first he told me the apparmor config was wrong (like here: mysql wont start Ubuntu 16.04.2 x64) which i fixed.
Now when I try to start the mysql service like this:
:~$ sudo /etc/init.d/mysql start
[....] Starting mysql (via systemctl): mysql.serviceJob for mysql.service
failed because the control process exited with error code. See "systemctl
status mysql.service" and "journalctl -xe" for details.
failed!
systemctl status mysql.service :
:~$ sudo systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) (Result: exit-code) since Tue 2018-04-24 19:01:31 UTC; 27s ago
Process: 22818 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 22809 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 22818 (code=exited, status=1/FAILURE); : 22819 (mysql-systemd-s)
Tasks: 2
Memory: 324.0K
CPU: 287ms
CGroup: /system.slice/mysql.service
└─control
├─22819 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─22903 sleep 1
Apr 24 19:01:31 ip-172-31-38-155 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Apr 24 19:01:31 ip-172-31-38-155 systemd[1]: Stopped MySQL Community Server.
Apr 24 19:01:31 ip-172-31-38-155 systemd[1]: Starting MySQL Community Server...
Apr 24 19:01:33 ip-172-31-38-155 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
and the journalctl -ex looks like this:
journalctl -xe
-- The result is failed.
Apr 24 19:05:41 ip-172-31-38-155 systemd[1]: mysql.service: Unit entered failed state.
Apr 24 19:05:41 ip-172-31-38-155 systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 24 19:05:41 ip-172-31-38-155 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Apr 24 19:05:41 ip-172-31-38-155 systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Apr 24 19:05:41 ip-172-31-38-155 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Apr 24 19:05:43 ip-172-31-38-155 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Apr 24 19:06:12 ip-172-31-38-155 systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Apr 24 19:06:12 ip-172-31-38-155 systemd[1]: mysql.service: Unit entered failed state.
Apr 24 19:06:12 ip-172-31-38-155 systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 24 19:06:12 ip-172-31-38-155 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Apr 24 19:06:12 ip-172-31-38-155 systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Apr 24 19:06:12 ip-172-31-38-155 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Apr 24 19:06:14 ip-172-31-38-155 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
While the the cat /var/log/mysql/error.log | grep ERROR prints loads of these errors:
2018-04-24T19:10:22.941983Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2018-04-24T19:10:22.942643Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2018-04-24T19:10:22.942683Z 0 [ERROR] Aborting
The one whole cycle of the cat /var/log/error.log would look like this:
2018-04-24T19:14:01.701232Z 0 [Note] Shutting down plugin 'ngram'
2018-04-24T19:14:01.701238Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2018-04-24T19:14:01.701241Z 0 [Note] Shutting down plugin 'partition'
2018-04-24T19:14:01.701243Z 0 [Note] Shutting down plugin 'ARCHIVE'
2018-04-24T19:14:01.701246Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2018-04-24T19:14:01.701249Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2018-04-24T19:14:01.701251Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2018-04-24T19:14:01.701253Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2018-04-24T19:14:01.701256Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2018-04-24T19:14:01.701258Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2018-04-24T19:14:01.701260Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2018-04-24T19:14:01.701263Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2018-04-24T19:14:01.701265Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2018-04-24T19:14:01.701267Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2018-04-24T19:14:01.701270Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2018-04-24T19:14:01.701272Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2018-04-24T19:14:01.701274Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2018-04-24T19:14:01.701277Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2018-04-24T19:14:01.701279Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2018-04-24T19:14:01.701282Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2018-04-24T19:14:01.701284Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2018-04-24T19:14:01.701286Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2018-04-24T19:14:01.701289Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2018-04-24T19:14:01.701291Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2018-04-24T19:14:01.701293Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2018-04-24T19:14:01.701296Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2018-04-24T19:14:01.701298Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2018-04-24T19:14:01.701300Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2018-04-24T19:14:01.701303Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2018-04-24T19:14:01.701305Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2018-04-24T19:14:01.701307Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2018-04-24T19:14:01.701310Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2018-04-24T19:14:01.701312Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2018-04-24T19:14:01.701314Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2018-04-24T19:14:01.701317Z 0 [Note] Shutting down plugin 'InnoDB'
2018-04-24T19:14:01.701363Z 0 [Note] InnoDB: FTS optimize thread exiting.
2018-04-24T19:14:01.701444Z 0 [Note] InnoDB: Starting shutdown...
2018-04-24T19:14:01.701486Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2018-04-24T19:14:01.701522Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180424 19:14:01 (/var/lib/mysql/ib_buffer_pool was empty)
2018-04-24T19:14:01.701533Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2018-04-24T19:14:01.701632Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 180424 19:14:01
2018-04-24T19:14:03.309269Z 0 [Note] InnoDB: Shutdown completed; log sequence number 8715994
2018-04-24T19:14:03.310751Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-04-24T19:14:03.310767Z 0 [Note] Shutting down plugin 'MyISAM'
2018-04-24T19:14:03.310781Z 0 [Note] Shutting down plugin 'CSV'
2018-04-24T19:14:03.310794Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2018-04-24T19:14:03.310840Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2018-04-24T19:14:03.310844Z 0 [Note] Shutting down plugin 'MEMORY'
2018-04-24T19:14:03.310848Z 0 [Note] Shutting down plugin 'sha256_password'
2018-04-24T19:14:03.310850Z 0 [Note] Shutting down plugin 'mysql_native_password'
2018-04-24T19:14:03.310975Z 0 [Note] Shutting down plugin 'binlog'
2018-04-24T19:14:03.311078Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
2018-04-24T19:14:32.669339Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2018-04-24T19:14:32.669378Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2018-04-24T19:14:32.820589Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-04-24T19:14:32.822172Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.22-0ubuntu0.16.04.1) starting as process 25440 ...
2018-04-24T19:14:32.826095Z 0 [Note] InnoDB: PUNCH HOLE support available
2018-04-24T19:14:32.826121Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-04-24T19:14:32.826125Z 0 [Note] InnoDB: Uses event mutexes
2018-04-24T19:14:32.826129Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-04-24T19:14:32.826133Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2018-04-24T19:14:32.826136Z 0 [Note] InnoDB: Using Linux native AIO
2018-04-24T19:14:32.826367Z 0 [Note] InnoDB: Number of pools: 1
2018-04-24T19:14:32.826496Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-04-24T19:14:32.827971Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-04-24T19:14:32.835607Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-04-24T19:14:32.837529Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-04-24T19:14:32.849179Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-04-24T19:14:32.858128Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-04-24T19:14:32.858180Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-04-24T19:14:32.892813Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-04-24T19:14:32.893685Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-04-24T19:14:32.893696Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-04-24T19:14:32.893952Z 0 [Note] InnoDB: Waiting for purge to start
2018-04-24T19:14:32.944316Z 0 [Note] InnoDB: 5.7.22 started; log sequence number 8715994
2018-04-24T19:14:32.944678Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
2018-04-24T19:14:32.944791Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2018-04-24T19:14:32.945139Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-04-24T19:14:32.945192Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2018-04-24T19:14:32.945201Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2018-04-24T19:14:32.945209Z 0 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2018-04-24T19:14:32.945237Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2018-04-24T19:14:32.945363Z 0 [Warning] Failed to open optimizer cost constant tables
2018-04-24T19:14:32.945455Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2018-04-24T19:14:32.945497Z 0 [ERROR] Aborting
2018-04-24T19:14:32.945522Z 0 [Note] Binlog end
On the one hand I have seen that the the error.log tells me to run run mysql_upgrade which i cannot do because the database itself is not running.
The [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist should be fixed by an initilize command onto the service which wont work either because the service itself is not running.
I do not have a single clue what to do next. My personal best Idea for now would be to reinstall the MySql server and copy beforehand the /var/lib/mysql/mysql and the /etc/mysql directories to insert them later as a backup.
I hope anyone of you has heard something about the problem or has any kind of idea what to do. Preferably while keeping my Data.
I hope, I provided all information you need. If you need any more, just ask.
Thanks a lot in advance!