Can't start mysqld_safe on linux - mysql

I've downloaded mysql binaries and I'm trying to follow instructions here for installation. when I try to run bin/mysqld_safe --user=mysql & command I get the following output:
40211 19:04:56 mysqld_safe Logging to '/usr/local/mysql/data/irpowerweb.err'.
140211 19:04:56 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
140211 19:04:57 mysqld_safe mysqld from pid file /usr/local/mysql/data/irpowerweb.pid ended
The content of the error log is:
140211 19:07:01 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2014-02-11 19:07:02 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-02-11 19:07:02 19511 [Note] Plugin 'FEDERATED' is disabled.
2014-02-11 19:07:02 19511 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2014-02-11 19:07:02 19511 [Note] InnoDB: The InnoDB memory heap is disabled
2014-02-11 19:07:02 19511 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation
2014-02-11 19:07:02 19511 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-02-11 19:07:02 19511 [Note] InnoDB: Using Linux native AIO
2014-02-11 19:07:02 19511 [Note] InnoDB: Not using CPU crc32 instructions
2014-02-11 19:07:02 19511 [Note] InnoDB: Initializing buffer pool, size = 64.0M
InnoDB: mmap(68370432 bytes) failed; errno 12
2014-02-11 19:07:02 19511 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2014-02-11 19:07:02 19511 [ERROR] Plugin 'InnoDB' init function returned error.
2014-02-11 19:07:02 19511 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2014-02-11 19:07:02 19511 [ERROR] Unknown/unsupported storage engine: InnoDB
2014-02-11 19:07:02 19511 [ERROR] Aborting
2014-02-11 19:07:02 19511 [Note] Binlog end
...
Shutting down stuff
...
2014-02-11 19:07:02 19511 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
140211 19:07:02 mysqld_safe mysqld from pid file /usr/local/mysql/data/irpowerweb.pid ended
Here's my.cnf:
[mysqld]
innodb_buffer_pool_size = 64M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
I just want to get mysql running in w/e way. I tried installing the package using yum install mysql-server, downloading rpm packages and failed to get it started. I settled for simple tar package and started following the link above but then again I failed to get it started.
Since the error states Cannot allocate memory for the buffer pool I tried reducing the memory to 64m (default was 128m) and it didn't work.
I'm a newbie in this, I've done a lot of searching around and haven't figured out how to fix this.
P.S. If it help, I'm using ssh to connect to a server with low memory (512MB of memory with no swap), and I think it's a red hat Linux.

I found my answer here. Used the following my.cnf and it worked:
[mysqld]
innodb=OFF
ignore-builtin-innodb
skip-innodb
default-storage-engine=myisam
default-tmp-storage-engine=myisam

Try adding:
[mysqld]
...
skip-bdb
skip-innodb
This will stop the Berkley DB and InnoDB from being started at all.

Your most significant error is:
Cannot allocate memory for the buffer pool
You'll have to lower it, in my.cnf.
When you run free, mysqld_safe is already done cleaning up, so you'd have to monitor memory via another terminal. But it's quite normal that a default my.cnf will use up your available memory. This is one of the reasons why Debian does not ship with a default my.cnf config.
update:
just in case, make sure to:
Follow MySQL Tuner's advices for your system.
Make sure SELinux is either turned off or set to allow mysql
Make sure your stack size is large enough using ulimit -s (you can increase it: ulimit -s <new_size> or even ulimit -s unlimited)

Related

Can't restart MySQL caused by InnoDB

I can't restart MySQL or recover MySQL from ( InnoDB tables )
I have one WSL using Ubuntu 16.04. By "unknown" accident, at morning i can't access MySQL. Tried to restart it and ... all errors.
Tried with all advice about InnoDB & log* files. But not success.
I did backup /var/lib/mysql and re-install new instance of WSL - Ubuntu 16.04
Tried to recover from physical backup files ( log* & data files & database directory ). But still have same errors.
[Update 1]
Follow this guide: https://dba.stackexchange.com/questions/71596/restoring-mysql-tables-from-ibd-frm-and-mysqllogbin-files
I have re-installed another WSL
Follow guide to restore db from .frm & .idb
Everything goes well until IMPORT TABLESPACE.
MySQL keep saying :
ERROR 1812 (HY000): Tablespace is missing for table `dbname`.`table`
2019-05-16T03:04:36.061132Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2019-05-16T03:04:36.207628Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2019-05-16T03:04:36.208347Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2019-05-16T03:04:36.472045Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-05-16T03:04:36.481592Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.26-0ubuntu0.16.04.1) starting as process 15703 ...
2019-05-16T03:04:36.503219Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-05-16T03:04:36.503655Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-05-16T03:04:36.503712Z 0 [Note] InnoDB: Uses event mutexes
2019-05-16T03:04:36.503749Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-05-16T03:04:36.503783Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2019-05-16T03:04:36.503823Z 0 [Note] InnoDB: Using Linux native AIO
2019-05-16T03:04:36.504677Z 0 [Note] InnoDB: Number of pools: 1
2019-05-16T03:04:36.505431Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-05-16T03:04:36.521629Z 0 [ERROR] InnoDB: Linux Native AIO interface is not supported on this platform. Please check your OS documentation and install appropriate binary of InnoDB.
2019-05-16T03:04:36.521855Z 0 [Note] InnoDB: You can disable Linux Native AIO by setting innodb_use_native_aio = 0 in my.cnf
2019-05-16T03:04:36.521899Z 0 [Warning] InnoDB: Linux Native AIO disabled.
2019-05-16T03:04:36.525155Z 0 [Note] InnoDB: Initializing buffer pool, total size = 4G, instances = 8, chunk size = 128M
2019-05-16T03:04:37.245621Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-05-16T03:04:37.452784Z 0 [Note] InnoDB: page_cleaner coordinator priority: -20
2019-05-16T03:04:37.453044Z 0 [Note] InnoDB: page_cleaner worker priority: -20
2019-05-16T03:04:37.453378Z 0 [Note] InnoDB: page_cleaner worker priority: -20
2019-05-16T03:04:37.453477Z 0 [Note] InnoDB: page_cleaner worker priority: -20
2019-05-16T03:04:37.461387Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2019-05-16T03:04:37.587188Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 22709914082 and the end 22709914054.
2019-05-16T03:04:37.587391Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-05-16T03:04:37.890878Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-05-16T03:04:37.891081Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-05-16T03:04:37.891128Z 0 [ERROR] Failed to initialize builtin plugins.
2019-05-16T03:04:37.891164Z 0 [ERROR] Aborting
2019-05-16T03:04:37.891207Z 0 [Note] Binlog end
2019-05-16T03:04:37.891332Z 0 [Note] Shutting down plugin 'CSV'
2019-05-16T03:04:37.891962Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
2019-05-16T03:04:37.959132Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended ````
For [ERROR] InnoDB: Linux Native AIO interface is not supported on this platform. Please check your OS documentation and install appropriate binary of InnoDB.:
Solution: Add the following lines at /etc/mysql/my.cnf
[mysqld]
innodb_use_native_aio = 0
For [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 92858715 and the end 92858687.:
Solution: Delete the ib_logfiles from /var/lib/mysql
sudo rm -rf /var/lib/mysql/ib_logfile*
I had a similar problem. I was using MySQL in docker but this solution is same for both. You need to remove ib_logfiles
If you are not using docker then
rm -rf /var/lib/mysql/ib_logfile*
And if you using docker then
cd /your_mount_path/
then run
rm -rf * ib_logfile*
Note: Make sure you make a backup of the data or volume as I ended up losing my data.
if anyone's ended up here struggling with wix-embedded-mysql and for some reason can't change the mysql settings in your WSL distro or host unix system, you can just disable it through the custom mysqld setting .withServerVariable like:
.withServerVariable("innodb_use_native_aio", 0)
That option's only doable if you really don't care about InnoDB usage in your code though.

Mysql server is not getting started on Amazon ec2

I have installed mysql server on ec2 AMI. Suddenly stopped working mysql server and its not getting started.
Here is mysql log :
160629 4:28:37 [Note] /usr/libexec/mysql55/mysqld (mysqld 5.5.46) starting as process 3059 ...
160629 4:28:37 [Note] Plugin 'FEDERATED' is disabled.
160629 4:28:37 InnoDB: The InnoDB memory heap is disabled
160629 4:28:37 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160629 4:28:37 InnoDB: Compressed tables use zlib 1.2.8
160629 4:28:37 InnoDB: Using Linux native AIO
160629 4:28:37 InnoDB: Initializing buffer pool, size = 512.0M
160629 4:28:37 InnoDB: Completed initialization of buffer pool
160629 4:28:37 InnoDB: highest supported file format is Barracuda.
InnoDB: No valid checkpoint found.
InnoDB: If this error appears when you are creating an InnoDB database,
InnoDB: the problem may be that during an earlier attempt you managed
InnoDB: to create the InnoDB data files, but log file creation failed.
InnoDB: If that is the case, please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/error-creating-innodb.html
160629 4:28:37 [ERROR] Plugin 'InnoDB' init function returned error.
160629 4:28:37 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160629 4:28:37 [ERROR] Unknown/unsupported storage engine: InnoDB
160629 4:28:37 [ERROR] Aborting
160629 4:28:37 [Note] /usr/libexec/mysql55/mysqld: Shutdown complete
160629 04:28:37 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Here are approach what I have tried yet:
1) Upgraded EC2 t2.micro to t2.medium.
2) Increased innodb_buffer_pool_size in my.cnf
3) Rename ib_logfile0 and ib_logfile1
Please suggest what next step should I do to start mysql.
Edit:
Sudo free -m
total used free shared buffers cached
Mem: 3954 149 3805 0 9 86
-/+ buffers/cache: 53 3901
Edit:
Is there only solution to uninstall mysql and re-install ?
If yes, then how can retain already created databases in mysql? Please Suggest.
Please go through the below link which is being given in your error logs.
It has mentioned certain steps to solve runtime exception .You can cross check and proceed. If nothing helped than you can opt for uninstallation.
http://dev.mysql.com/doc/refman/5.5/en/error-creating-innodb.html

Server is shutting down every few minuts and MYSQL Daemon is failing to start

I have a problem with my server. It shuts down every 2 minutes. I am using Digitalocean. I have changed to a newdroplet already it was fine for one month. then. I cannot even start MYSQL service.. this is my log:
160426 17:06:34 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
160426 17:08:04 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160426 17:08:04 [Note] /usr/libexec/mysqld (mysqld 5.5.48) starting as process 3334 ...
160426 17:08:04 [Note] Plugin 'FEDERATED' is disabled.
160426 17:08:04 InnoDB: The InnoDB memory heap is disabled
160426 17:08:04 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160426 17:08:04 InnoDB: Compressed tables use zlib 1.2.3
160426 17:08:04 InnoDB: Using Linux native AIO
160426 17:08:04 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
160426 17:08:04 InnoDB: Completed initialization of buffer pool
160426 17:08:04 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160426 17:08:04 [ERROR] Plugin 'InnoDB' init function returned error.
160426 17:08:04 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160426 17:08:04 [ERROR] Unknown/unsupported storage engine: InnoDB
160426 17:08:04 [ERROR] Aborting
Any help is appreciated..
Fatal error: cannot allocate memory for the buffer pool
How big is your buffer pool? How much memory do you have? Who installed MySQL on the server?
it was fine for one month
What has changed? What is using memory on your server?
For a tiny 0.5GB system, lots of things must be dialed back.
50 http processes -- from what? Apache: drastically decrease MaxClients, perhaps to 10. Others: ?
128MB is too much for 512MB. Try 50M.
max_connections should be perhaps 10.
Are your tables InnoDB? Or MyISAM?
If InnoDB, key_buffer_size = 5M, innodb_buffer_pool_size = 50M.
If MyISAM, key_buffer_size = 40M, innodb_buffer_pool_size = 0.
You have version 5.5.48 of MySQL. Did Digitalocean change it without your knowing it?

MYsql Shut down often for no reason and unable restart after

150505 16:57:01 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
150505 16:58:01 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150505 16:58:01 [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.
150505 16:58:01 [Note] Plugin 'FEDERATED' is disabled.
150505 16:58:01 InnoDB: The InnoDB memory heap is disabled
150505 16:58:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150505 16:58:01 InnoDB: Compressed tables use zlib 1.2.8
150505 16:58:01 InnoDB: Using Linux native AIO
150505 16:58:01 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
150505 16:58:01 InnoDB: Completed initialization of buffer pool
150505 16:58:01 InnoDB: Fatal error: cannot allocate memory for the buffer pool
150505 16:58:01 [ERROR] Plugin 'InnoDB' init function returned error.
150505 16:58:01 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
150505 16:58:01 [ERROR] Unknown/unsupported storage engine: InnoDB
150505 16:58:01 [ERROR] Aborting
Above is mysql error log, sometime mysql will just crash, and I want to do a restart on the service, it will not able to start,the error is something like
the "unknown instance" error.
Anyone got any idea what the error above is about and how to solve it, I tried google but seems to not able find the answer.
Thanks!
I found this question searching for an answer myself, my server's /var/log/mysql/error.log had very similar statements to yours. Running dmesg | tail -20 revealed the culprit: the OS ran out of memory and killed mysqld:
[835661.446277] Out of memory: Kill process 1024 (mysqld) score 91 or sacrifice child
[835661.446912] Killed process 1024 (mysqld) total-vm:901544kB, anon-rss:92332kB, file-rss:0kB
[835661.488337] init: mysql main process (1024) killed by KILL signal
Now to figure out why memory ran out, on this newer server, with twice as much RAM as the one it's replacing, which never did this...

Mysql doesn't run

I have no idea if this question fit to SO, but if it doesn't just close it...
The problem is that after migrating to another dedicated server, I can not get my MySQL server started, the loggs are saying the following:
120625 13:04:10 mysqld_safe mysqld from pid file /var/db/mysql/ropp.pid ended
120625 13:04:29 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
120625 13:04:29 InnoDB: The InnoDB memory heap is disabled
120625 13:04:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120625 13:04:29 InnoDB: Compressed tables use zlib 1.2.3
120625 13:04:29 InnoDB: Initializing buffer pool, size = 128.0M
120625 13:04:29 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 104857600 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
120625 13:04:29 [ERROR] Plugin 'InnoDB' init function returned error.
120625 13:04:29 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
120625 13:04:29 [ERROR] Unknown/unsupported storage engine: InnoDB
120625 13:04:29 [ERROR] Aborting
120625 13:04:29 [Note] /usr/local/libexec/mysqld: Shutdown complete
120625 13:04:29 mysqld_safe mysqld from pid file /var/db/mysql/ropp.pid ended
Where is the problem and what do I have to do?
My MySQL server version is 5.5.
The problem is that mysql configuration on your new server does not match the older one. The variable innodb_log_file_size is set to 5M but actual size of log is 100MB. You need to change that value in my.cnf.
Shutdown MySQL server if it is running (it should not be). Edit my.cnf and change the value of innodb_log_file_size to 100M
innodb_log_file_size = 100M
This should fix the problem. Start the server. If it doesn't work, then stop the server, move the ib_logfile0 and ib_logfile1 to .bak and start the server again.