ubuntu mysql setting problems - mysql

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

Related

Can not start mysql on linux

When I tried to restart mysql after I restarted Linux server,
I got in trouble, I am not able to start mysql It is responding Job failed to start
here is error log
170225 0:46:41 [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.
170225 0:46:41 [Note] Plugin 'FEDERATED' is disabled.
170225 0:46:41 InnoDB: The InnoDB memory heap is disabled
170225 0:46:41 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170225 0:46:41 InnoDB: Compressed tables use zlib 1.2.8
170225 0:46:41 InnoDB: Using Linux native AIO
170225 0:46:41 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
170225 0:46:41 InnoDB: Completed initialization of buffer pool
170225 0:46:41 InnoDB: Fatal error: cannot allocate memory for the buffer pool
170225 0:46:41 [ERROR] Plugin 'InnoDB' init function returned error.
170225 0:46:41 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
170225 0:46:41 [ERROR] Unknown/unsupported storage engine: InnoDB
170225 0:46:41 [ERROR] Aborting
170225 0:46:41 [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.
170225 0:46:41 [Note] Plugin 'FEDERATED' is disabled.
170225 0:46:41 InnoDB: The InnoDB memory heap is disabled
170225 0:46:41 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170225 0:46:41 InnoDB: Compressed tables use zlib 1.2.8
170225 0:46:41 InnoDB: Using Linux native AIO
170225 0:46:41 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
170225 0:46:41 InnoDB: Completed initialization of buffer pool
170225 0:46:41 InnoDB: Fatal error: cannot allocate memory for the buffer pool
170225 0:46:41 [ERROR] Plugin 'InnoDB' init function returned error.
170225 0:46:41 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
170225 0:46:41 [ERROR] Unknown/unsupported storage engine: InnoDB
170225 0:46:41 [ERROR] Aborting
thx for your help
Maybe the option "skip-innodb" was uncommented on configuration file my.cnf. If that's the case, comment the line again. If you don't want to use INNODB, you must modify your tables to use another table format, as MyISAM p.e.

MySql Config error

Have a Wordpress website running on Digital Ocean. This morning began receiving "Error establishing a database connection" message. Droplet is a 2 GB Memory / 40 GB HD running Ubuntu 14.04.
Tried restarting mysql, but get "Job Failed to Start".
Status reports "mysql stopped/waiting"
Help me anyone please.
Additionally I do not know how to set up SWAP.
170125 7:51:17 [Note] /usr/sbin/mysqld: Shutdown complete
170125 7:51:18 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will
170125 7:51:18 [Note] Plugin 'FEDERATED' is disabled. Th/usr/sbin/m.jsqld: Can't find file: 1./mysql/plugin.frml (errno: 13)
170125 7:51:18 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
170125 7:51:18 InnoDB: The InnoDB memory heap is disabled
170125 7:51:18 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170125 7:51:18 InnoDB: Compressed tables use zlib 1.2.8
170125 7:51:18 InnoDB: Using Linux native RIO
170125 7:51:18 InnoDB: Initializing buffer pool, size = 128.0M InnoDB: mmap(137363456 bytes) failed; errno 12
170125 7:51:18 InnoDB: Completed initialization of buffer pool
170125 7:51:18 InnoDB: Fatal error: cannot allocate memory for the buffer pool
170125 7:51:18 [ERROR] Plugin 'InnoDB' init function returned error.
170125 7:51:18 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed
170125 7:51:18 [ERROR] Unknown/unsupported storage engine: InnoDB
170125 7:51:18 [ERROR] Aborting
Error log is attached

AWS Micro Instance - MySQL keeps failing in Wordpress installation

I have a Ubuntu micro instance with default settings. As a matter of fact, this instance is the same as 8 others I have created prior and since to host Wordpress websites.
This one belongs to a Church, and unfortunately, it keeps having its MySql server going to heaven! I am not sure how to sort this, as the mysql.err log shows:
160301 5:03:40 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in$
160301 5:03:40 [Note] Plugin 'FEDERATED' is disabled.
160301 5:03:40 InnoDB: The InnoDB memory heap is disabled
160301 5:03:40 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160301 5:03:40 InnoDB: Compressed tables use zlib 1.2.8
160301 5:03:40 InnoDB: Using Linux native AIO
160301 5:03:40 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
160301 5:03:40 InnoDB: Completed initialization of buffer pool
160301 5:03:40 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160301 5:03:40 [ERROR] Plugin 'InnoDB' init function returned error.
160301 5:03:40 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160301 5:03:40 [ERROR] Unknown/unsupported storage engine: InnoDB
160301 5:03:40 [ERROR] Aborting
160301 5:03:40 [Note] /usr/sbin/mysqld: Shutdown complete
This is telling me it could not allocate the 128MB required for the buffer pool.
But, my free -m shows there is plenty of memory for this (I also set up a 2GB swap).
ubuntu#ip-xxx-xxx-xxx-xxx:/var/log/mysql$ free -m
total used free shared buffers cached
Mem: 992 634 358 54 76 308
-/+ buffers/cache: 249 742
Swap: 2047 0 2047
Any suggestions are appreciated!
Looks like there is not enough memory left for allocation during the start process.
add this to your /etc/mysql/my.cnf
innodb_buffer_pool_size = 20M

Recover DB from ibdata1, ib_logfile0, ib_logfile1 and .frm files

Recently My production server was corrupted due to maintenance shutdown by digital ocean. When we trying to recover our database we couldn't access our droplet. Somehow we managed to recover these (ibdata1, ib_logfile0, ib_logfile1 and some .frm) files. When i copied this files to my new mysql server(in another machine), I could't start the mysql server. I got this output
sudo service mysql restart
mysql stop/waiting
start: Job failed to start
I checked the log file and i got this error,
151019 8:55:27 [Warning] Using unique option prefix myisam-recover instead of $
151019 8:55:27 [Note] Plugin 'FEDERATED' is disabled.
151019 8:55:27 InnoDB: The InnoDB memory heap is disabled
151019 8:55:27 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151019 8:55:27 InnoDB: Compressed tables use zlib 1.2.8
151019 8:55:27 InnoDB: Using Linux native AIO
151019 8:55:27 InnoDB: Initializing buffer pool, size = 128.0M
151019 8:55:27 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
151019 8:55:27 [ERROR] Plugin 'InnoDB' init function returned error.
151019 8:55:27 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
151019 8:55:27 [ERROR] Unknown/unsupported storage engine: InnoDB
151019 8:55:27 [ERROR] Aborting
151019 8:55:27 [Note] /usr/sbin/mysqld: Shutdown complete
151019 8:55:28 [Warning] Using unique option prefix myisam-recover instead of $
151019 8:55:28 [Note] Plugin 'FEDERATED' is disabled.
151019 8:55:28 InnoDB: The InnoDB memory heap is disabled
151019 8:55:28 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151019 8:55:28 InnoDB: Compressed tables use zlib 1.2.8
151019 8:55:28 InnoDB: Using Linux native AIO
151019 8:55:28 InnoDB: Initializing buffer pool, size = 128.0M
151019 8:55:28 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
151019 8:55:28 [ERROR] Plugin 'InnoDB' init function returned error.
151019 8:55:28 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
151019 8:55:28 [ERROR] Unknown/unsupported storage engine: InnoDB
151019 8:55:28 [ERROR] Aborting
151019 8:55:28 [Note] /usr/sbin/mysqld: Shutdown complete
151019 8:55:29 [Warning] Using unique option prefix myisam-recover instead of $
151019 8:55:29 [Note] Plugin 'FEDERATED' is disabled.
151019 8:55:29 InnoDB: The InnoDB memory heap is disabled
151019 8:55:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151019 8:55:29 InnoDB: Compressed tables use zlib 1.2.8
151019 8:55:29 InnoDB: Using Linux native AIO
151019 8:55:29 InnoDB: Initializing buffer pool, size = 128.0M
151019 8:55:29 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
151019 8:55:29 [ERROR] Plugin 'InnoDB' init function returned error.
151019 8:55:29 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
151019 8:55:29 [ERROR] Unknown/unsupported storage engine: InnoDB
151019 8:55:29 [ERROR] Aborting
151019 8:55:29 [Note] /usr/sbin/mysqld: Shutdown complete
I tried adding innodb_log_file_size= 50331648 as suggested by #akuzminsky
Then I got this error log.
151022 6:54:13 [Warning] Using unique option prefix myisam-recover instead of $
151022 6:54:13 [Note] Plugin 'FEDERATED' is disabled.
151022 6:54:13 InnoDB: The InnoDB memory heap is disabled
151022 6:54:13 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151022 6:54:13 InnoDB: Compressed tables use zlib 1.2.8
151022 6:54:13 InnoDB: Using Linux native AIO
151022 6:54:13 InnoDB: Initializing buffer pool, size = 128.0M
151022 6:54:13 InnoDB: Completed initialization of buffer pool
151022 6:54:13 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 15379293
151022 6:54:13 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Error: space header page consists of zero bytes in file ./toucan/ormcli$
InnoDB: Error: space header page consists of zero bytes in file ./toucan/catego$
InnoDB: Error: space header page consists of zero bytes in file ./toucan/survey$
InnoDB: Error: space header page consists of zero bytes in file ./toucan/compla$
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 15382291
InnoDB: Page directory corruption: infimum not pointed to
151022 6:54:13 InnoDB: Page dump in ascii and hex (16384 bytes):
len 16384; hex 10cfd0d80000000000000000000000000000000000e9e915000800000000001$
InnoDB: End of page dump
151022 6:54:13 InnoDB: Page checksum 282054872, prior-to-4.0.14-form checksum$
InnoDB: stored checksum 282054872, prior-to-4.0.14-form stored checksum 3468306$
InnoDB: Page lsn 0 15329557, low 4 bytes of lsn at page end 15329557
InnoDB: Page number (if stored to page already) 0,
InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 0
InnoDB: Page may be a file space header page
10:54:13 UTC - mysqld got signal 11 ;
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.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
key_buffer_size=16777216
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
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 346701 K $
Hope that's ok; if not, decrease some variables in the equation.
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 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x20)[0x7fa4d90e2f10]
/usr/sbin/mysqld(handle_fatal_signal+0x3d5)[0x7fa4d8fcd175]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7fa4d7d5d340]
/usr/sbin/mysqld(+0x5f058a)[0x7fa4d91e258a]
/usr/sbin/mysqld(+0x56c44e)[0x7fa4d915e44e]
/usr/sbin/mysqld(+0x576137)[0x7fa4d9168137]
/usr/sbin/mysqld(+0x5a5632)[0x7fa4d9197632]
/usr/sbin/mysqld(+0x5a6699)[0x7fa4d9198699]
/usr/sbin/mysqld(+0x591ad3)[0x7fa4d9183ad3]
/usr/sbin/mysqld(+0x542a1a)[0x7fa4d9134a1a]
/usr/sbin/mysqld(+0x511d48)[0x7fa4d9103d48]
/usr/sbin/mysqld(_Z24ha_initialize_handlertonP13st_plugin_int+0x41)[0x7fa4d8fcf$
/usr/sbin/mysqld(+0x302221)[0x7fa4d8ef4221]
/usr/sbin/mysqld(_Z11plugin_initPiPPci+0x92a)[0x7fa4d8ef821a]
/usr/sbin/mysqld(+0x28ac5b)[0x7fa4d8e7cc5b]
/usr/sbin/mysqld(_Z11mysqld_mainiPPc+0x45b)[0x7fa4d8e815db]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7fa4d739fec5]
/usr/sbin/mysqld(+0x286b18)[0x7fa4d8e78b18]
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.
Please help me to resolve this.
Thanks in advance.
Note lines in the error log:
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
The actual size of the redo log file differs from the size in MySQL config.
Add this line to my.cnf
innodb_log_file_size= 50331648
If the tablespace is corrupted you'll still have to heal it. But at least MySQL won't stop at this step.

mysql stopped unexpectly, the causes?

I have a VPS, and today, the mysql service stopped, the error is
140821 2:35:21 [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.
140821 2:35:21 [Note] Plugin 'FEDERATED' is disabled.
140821 2:35:21 InnoDB: The InnoDB memory heap is disabled
140821 2:35:21 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140821 2:35:21 InnoDB: Compressed tables use zlib 1.2.8
140821 2:35:21 InnoDB: Using Linux native AIO
140821 2:35:21 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140821 2:35:21 InnoDB: Completed initialization of buffer pool
140821 2:35:21 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140821 2:35:21 [ERROR] Plugin 'InnoDB' init function returned error.
140821 2:35:21 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140821 2:35:21 [ERROR] Unknown/unsupported storage engine: InnoDB
140821 2:35:21 [ERROR] Aborting
140821 2:35:21 [Note] /usr/sbin/mysqld: Shutdown complete
140821 2:35:22 [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.
140821 2:35:22 [Note] Plugin 'FEDERATED' is disabled.
140821 2:35:22 InnoDB: The InnoDB memory heap is disabled
140821 2:35:22 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140821 2:35:22 InnoDB: Compressed tables use zlib 1.2.8
140821 2:35:22 InnoDB: Using Linux native AIO
140821 2:35:22 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140821 2:35:22 InnoDB: Completed initialization of buffer pool
140821 2:35:22 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140821 2:35:22 [ERROR] Plugin 'InnoDB' init function returned error.
140821 2:35:22 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140821 2:35:22 [ERROR] Unknown/unsupported storage engine: InnoDB
140821 2:35:22 [ERROR] Aborting
140821 2:35:22 [Note] /usr/sbin/mysqld: Shutdown complete
Any explanation for this?
Error arises because of your memory allocation limit. It can be referred to as an Out of memory exception. It can arise again in case of high memory usage.
As you can see, the InnoDB buffer pool size is set to 128MB.
Change your buffer pool size to avoid the error again;
add this to your my.cnf
innodb_buffer_pool_size=1G
restart your mysql to make it effect