InnoDB Cannot allocate memory for the buffer pool - mysql

I've installed mysql, it works well, but sometimes I have:
Aborted connection 114069 to db: 'db1' user: 'root' host: 'localhost' (Got an error reading communication packets)
I've tried to solve it:sudo mysqld --max_allowed_packet=128M
but after it mysql doesn't work at all
2019-04-08T18:42:11.047491Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-04-08T18:42:11.047520Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2019-04-08T18:42:11.047530Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2019-04-08T18:42:11.047534Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-04-08T18:42:11.047539Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-04-08T18:42:11.047555Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-04-08T18:42:11.047559Z 0 [ERROR] Failed to initialize builtin plugins.
2019-04-08T18:42:11.047562Z 0 [ERROR] Aborting
I don't know to which file mysql wrote this confit to remove it. How can I solve it or rollback?

Related

Mysql with magento causing drop in mysql connection

What does these errors mean and why does they occur
2020-12-11T10:11:48.355887Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2020-12-11T10:11:48.356116Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-12-11T10:11:48.356132Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-12-11T10:11:48.356650Z 0 [ERROR] Failed to initialize builtin plugins.
2020-12-11T10:11:48.356665Z 0 [ERROR] Aborting
2020-12-11T10:11:48.357957Z 0 [Note] Binlog end
2020-12-11T10:11:48.364822Z 0 [Note] Shutting down plugin 'CSV'
2020-12-11T10:11:48.366417Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
The following error occured due to magento setup:upgrade
As a result the mysql connection keeps dropping for every request (if i refresh page.navigate to other page)

can't access local mariadb mac: InnoDB error

I am trying to setup MariaDB on my local machine.
Whenever I try to log in with:
mariadb -u <mac_name> or mariadb -u root I get this error:
using my mac password also doesn't work.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
When I tail the logs found at /usr/local/var/mysql/<host_name>.err or /usr/local/var/mysql/<host_name>.local.err
I get these errors:
[Note] InnoDB: Completed initialization of buffer pool
[ERROR] InnoDB: Invalid flags 0x4800 in ./ibdata1
[ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption
[Note] InnoDB: Starting shutdown...
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[Note] Plugin 'FEEDBACK' is disabled.
[ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting
Does anyone know how I could get this working?

mysql shutting too frequently

MySql shutting frequently:
I am getting this error:
2019-12-30T15:29:35.139597Z 0 [ERROR] InnoDB: Operating system error number 23 in a file operation.
2019-12-30T15:29:35.139597Z 0 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html
2019-12-30T15:29:35.139597Z 0 [ERROR] InnoDB: File .\pink_square_wov\sales_entry_header.ibd: 'Windows aio' returned OS error 123. Cannot continue operation
2019-12-30T15:29:35.139597Z 0 [ERROR] InnoDB: Cannot continue operation.
2019-12-30T15:29:39.341887Z 0 [Note] InnoDB: FTS optimize thread exiting.
2019-12-30T15:31:24.046589Z 0 [Warning] InnoDB: 13 threads created by InnoDB had not exited at shutdown!
How can I fix that
I am using:
MySql 5.7.17
Windows 10

Why MySQL Restarted When Number of Processes Running Now 0

Some background. I hosted a WordPress site in VPS and sometimes MYSQL down with error "Error Establishing a Database Connection". I've spent some time to research and believe the problem is due to when MySQL get restarted, it is not able to allocate enough RAM to proceed.
I believe I can improve the situation by increasing physical RAM or swap. But my question for this post is, why MySQL need to restart itself? My site is with pretty low traffic and doesn't seem like the DB is corrupted.
Below is the full log for this issue:
160103 18:39:54 mysqld_safe Number of processes running now: 0
160103 18:39:54 mysqld_safe mysqld restarted
160103 18:39:55 [Note] /usr/libexec/mysqld (mysqld 5.5.44-MariaDB) starting as process 22061 ...
160103 18:39:55 InnoDB: The InnoDB memory heap is disabled
160103 18:39:55 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160103 18:39:55 InnoDB: Compressed tables use zlib 1.2.7
160103 18:39:55 InnoDB: Using Linux native AIO
160103 18:39:55 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137756672 bytes) failed; errno 12
160103 18:39:55 InnoDB: Completed initialization of buffer pool
160103 18:39:55 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160103 18:39:56 [ERROR] Plugin 'InnoDB' init function returned error.
160103 18:39:56 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160103 18:39:56 [ERROR] mysqld: Out of memory (Needed 128917504 bytes)
160103 18:39:56 [ERROR] mysqld: Out of memory (Needed 96681984 bytes)
160103 18:39:56 [ERROR] mysqld: Out of memory (Needed 72499200 bytes)
160103 18:39:56 [Note] Plugin 'FEEDBACK' is disabled.
160103 18:39:56 [ERROR] Unknown/unsupported storage engine: InnoDB
160103 18:39:56 [ERROR] Aborting
When Number of Processes Running Now 0 means that MySQL isn't running. So the daemon mysqld_safe "makes you a favor" and start MySQL
You have assigned very low RAM 128MB to innodb_buffer_pool_size (which is default RAM). So you should assign approx. 80% of total RAM to this variable if you are using innodb engine, as mysql uses intially memory from this variable to cache index as well data in innodb engine.
So update at least 1 GB RAM (should be 80% of total ram for innodb) to innodb_buffer_pool_size in your config file and restart mysql service.
Update:
You have 1 GB RAM: You can assign 800M RAM (or >=500M) to innodb_buffer_pool_size.
MySQL will auto restart when number of running process 0: As per errors shared by you...this error is coming at the time of mysql service start and server is not able to initiate mysql service with such a less RAM.
160103 18:39:55 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137756672 bytes) failed; errno 12
160103 18:39:55 InnoDB: Completed initialization of buffer pool
160103 18:39:55 InnoDB: Fatal error: cannot allocate memory for the buffer pool
I had a similar problem with MySQL on CentOS 6.9. It was caused by memory starving due another PHP process and not by MySQL. MySQL was just a victim.
You can look at kernel messages. The location of this messages may be specific to OS. In case of CentOS 6.x they are located in /var/log/messages .
Here are some related messages from /var/log/messages:
Jul 25 20:34:46 myserver kernel: Out of memory: Kill process 21467 (mysqld) score 30 or sacrifice child
Jul 25 20:34:46 myserver kernel: Killed process 21467, UID 497, (mysqld) total-vm:757004kB, anon-rss:17728kB, file-rss:320kB
You can run the following command to see if kernel run out of memory:
cat /var/log/messages | grep out_of_memory

ubuntu mysql setting problems

Hi all I have ubuntu installed on my server with apache2 and mysql; every now and then I get this message:
Warning: mysql_connect(): [2002] Connection refused
(trying to connect via unix:///var/run/mysqld/mysqld.sock) in /var/www/fanta-trade/wp-includes/wp-db.php on line 1142
Warning: mysql_connect(): Connection refused in /var/www/fanta-trade/wp-includes/wp-db.php on line 1142`
I do not think is a script error because if I restart apache it starts working again. How can I solve it?
I add also the mysql log:
150719 11:05:52 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
150719 11:05:52 [Note] Plugin 'FEDERATED' is disabled.
150719 11:05:52 InnoDB: The InnoDB memory heap is disabled
150719 11:05:52 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150719 11:05:52 InnoDB: Compressed tables use zlib 1.2.3.4
150719 11:05:52 InnoDB: Initializing buffer pool, size = 16.0M
InnoDB: mmap(17170432 bytes) failed; errno 12
150719 11:05:52 InnoDB: Completed initialization of buffer pool
150719 11:05:52 InnoDB: Fatal error: cannot allocate memory for the buffer pool
150719 11:05:52 [ERROR] Plugin 'InnoDB' init function returned error.
150719 11:05:52 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
150719 11:05:53 [ERROR] Unknown/unsupported storage engine: InnoDB
150719 11:05:53 [ERROR] Aborting
i setted
innodb_buffer_pool_size = 38M