Mysql doesn't run - mysql

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.

Related

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?

What to do when I get "mysqld dead but subsys locked" in my amazon ec2 micro instance?

I have an Amazon ec2 micro instance that holds a WordPress site. Since yesterday, my mysql db keep crashing saying:
[ec2-user#ip-xxx-xx-xx-xxx ~]$ sudo service mysqld status
mysqld dead but subsys locked
I tried restarting the mysqld but after every 5 mins it keeps crashing with the same message - "Error establishing a database connection"
This is what my DB log file reads -
160123 05:44:41 mysqld_safe mysqld restarted
160123 5:44:43 [Note] /usr/libexec/mysql55/mysqld (mysqld 5.5.46) starting as process 7928 ...
160123 5:44:44 [Note] Plugin 'FEDERATED' is disabled.
160123 5:44:46 InnoDB: The InnoDB memory heap is disabled
160123 5:44:46 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160123 5:44:46 InnoDB: Compressed tables use zlib 1.2.8
160123 5:44:46 InnoDB: Using Linux native AIO
160123 5:44:46 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
160123 5:44:46 InnoDB: Completed initialization of buffer pool
160123 5:44:46 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160123 5:44:46 [ERROR] Plugin 'InnoDB' init function returned error.
160123 5:44:46 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160123 5:44:46 [ERROR] Unknown/unsupported storage engine: InnoDB
160123 5:44:46 [ERROR] Aborting
160123 5:44:46 [Note] /usr/libexec/mysql55/mysqld: Shutdown complete
160123 05:44:46 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
The common solution that found out there when I Googled for a solution for the issue - mysqld dead but subsys locked, is to create a swapfile. I did exactly as most of the solution suggest but since I'm not well versed with UNIX, I don't know what I have done is right or not.
Or, Is there any other solution for this issue. Kindly help.
Have you tried this mysql is dead but subsys locked
Seems quite straightforward. Also please consider moving to RDS instead of running a mysql server in ec2. Saves you from troubles of this kind.

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...

When I uncomment innodb in my.cf it breaks

I'm wondering why when I uncomment the following lines in the /etc/my.cf it breaks mysql and I'm unable to restart it. I'm not all that great with mysql but I've been googling for hours trying to figure it out. Innodb is running on my server and all my db are running innodb. If I can provide you guys with more info please let me know how.
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 384M
#innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 100M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
Edit: This is what the mysql error log says
140129 8:53:21 [Note] Plugin 'FEDERATED' is disabled.
140129 8:53:21 InnoDB: The InnoDB memory heap is disabled
140129 8:53:21 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140129 8:53:21 InnoDB: Compressed tables use zlib 1.2.3
140129 8:53:21 InnoDB: Using Linux native AIO
140129 8:53:21 InnoDB: Initializing buffer pool, size = 384.0M
140129 8:53:21 InnoDB: Completed initialization of buffer pool
InnoDB: Error: data file /var/lib/mysql/ibdata1 is of a different size
InnoDB: 19072 pages (rounded down to MB)
InnoDB: than specified in the .cnf file 128000 pages!
140129 8:53:21 InnoDB: Could not open or create data files.
140129 8:53:21 InnoDB: If you tried to add new data files, and it failed here,
140129 8:53:21 InnoDB: you should now edit innodb_data_file_path in my.cnf back
140129 8:53:21 InnoDB: to what it was, and remove the new ibdata files InnoDB created
140129 8:53:21 InnoDB: in this failed attempt. InnoDB only wrote those files full of
140129 8:53:21 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
140129 8:53:21 InnoDB: remove old data files which contain your precious data!
140129 8:53:21 [ERROR] Plugin 'InnoDB' init function returned error.
140129 8:53:21 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140129 8:53:21 [ERROR] Unknown/unsupported storage engine: InnoDB
140129 8:53:21 [ERROR] Aborting
To save this, just add the following to the /etc/mysql/my.cnf file (reference):
skip-innodb
Before do anything backup your data !
Remove files starting with ib_logfile , should be ib_logfile0 and ib_logfile1 in /var/lib/mysql.
Then re/start the server