mysql not starting on mamp - mysql

I've been using MAMP for quite a while now but a few months ago it started to give me issues. I've since looked online through google searches and stack overflow to find a resolution but I haven't seen anything that could help me yet.
I've searched for some articles but these that I felt would have been close to helping me did not:
MAMP mysql not starting
I'm not sure the path to my data directory? and anything I type in the terminal seems to come back as commmand not found
Mysql service won't start, InnoDB init function error
MAMP mysql server won't start. No mysql processes are running
I attempted to killall but "No matching processes belonging to you were found" error was shown
About an hour ago my mqsql was working but not apache, so I found as article that said to rename Library/bin/envvars to _envvars, apache worked on startup but then mysql didn't.
I'm not getting any errors in my php log but here is my apache and mysql logs.
Here is a snippet from the bottom of the mysql error log
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
170118 15:52:39 InnoDB: Unable to open the first data file
InnoDB: Error in opening ./ibdata1
170118 15:52:39 InnoDB: Operating system error number 35 in a file operation.
InnoDB: Error number 35 means 'Resource temporarily unavailable'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/operating-system-error-codes.html
170118 15:52:39 InnoDB: Could not open or create data files.
170118 15:52:39 InnoDB: If you tried to add new data files, and it failed here,
170118 15:52:39 InnoDB: you should now edit innodb_data_file_path in my.cnf back
170118 15:52:39 InnoDB: to what it was, and remove the new ibdata files InnoDB created
170118 15:52:39 InnoDB: in this failed attempt. InnoDB only wrote those files full of
170118 15:52:39 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
170118 15:52:39 InnoDB: remove old data files which contain your precious data!
170118 15:52:39 [ERROR] Plugin 'InnoDB' init function returned error.
170118 15:52:39 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
170118 15:52:39 [ERROR] Unknown/unsupported storage engine: InnoDB
170118 15:52:39 [ERROR] Aborting
170118 15:52:39 [Note] /Applications/MAMP/Library/bin/mysqld: Shutdown complete
170118 15:52:39 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
and then the apache error log
[Wed Jan 18 15:48:28 2017] [notice] Digest: generating secret for digest authentication ...
[Wed Jan 18 15:48:28 2017] [notice] Digest: done
[Wed Jan 18 15:48:28 2017] [notice] Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8zh DAV/2 PHP/5.3.6 configured -- resuming normal operations
[Wed Jan 18 15:48:31 2017] [notice] caught SIGTERM, shutting down
[Wed Jan 18 15:51:01 2017] [notice] Digest: generating secret for digest authentication ...
[Wed Jan 18 15:51:01 2017] [notice] Digest: done
[Wed Jan 18 15:51:01 2017] [notice] Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8zh DAV/2 PHP/5.3.6 configured -- resuming normal operations
My ports are: apache 80 and mysql 3306.
If anyone might know what might be happening that would be amazing..

Back in December, when I had this same problem in my Mac, I explored a bit and found a very simple solution:
Quit MAMP
In the finder go to Applications/MAMP/db/mysql56/ and delete the last log file, in my case ib_logfile1. (It might be a good idea to back up this file before deleting it, or alternatively move it to a different location instead of deleting it.)
Restart MAMP. That's it!
Some people had reported that deleting also ib_logfile0 was necessary, but not in my case. You can check this in JuanFra.me blog where I first posted my solution last year.
I don't know why or how this solution worked, but it seems that it has been helpful to many others, as reported in JuanFra's blog. I hope it is useful to you as well.

Another copy of MySQL/MariaDB currently running?
ibdata1 on some odd file system partition?

Did you by chance restore from a backup taken from an instance that was up?
The following is excerpted from https://dev.mysql.com/doc/refman/5.7/en/backup-types.html
Physical backup methods have these characteristics:
• Backups can be performed while the MySQL server is not running. If the server is running, it is necessary to perform appropriate locking so that the server does not change database contents during the backup. MySQL Enterprise Backup does this locking automatically for tables that require it.

To stop MySQL There are different cases depending on whether you installed MySQL with the official binary installer, using MacPorts, or using Homebrew:
MacPorts
sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mysql.plist
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql.plist
Note: this is persistent after reboot.
Homebrew
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Binary installer
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart

If MySQL isn't starting it is pretty likely that it could already be running. You can very easily manually turn it off in the terminal.
I've had this happen to me a few times and I believe it has something to do with not shutting MAMP off correctly.
Quit MAMP.
Open the terminal and type: killall -9 mysqld
Restart MAMP.

Quit MAMP
go to /Applications/MAMP/tmp/mysql/ and add file
Restart MAMP. That's it!

Related

MySQL Server not starting with MAMP

My MySQL Server wont start anymore on MAMP. The solutions I found online said, that I should first quit MAMP, quit the MYSQL process, and start MAMP again.
But there is no MySQL process running in my situation, so this didn't work. Do you have any idea, what else could be the process?
You can find my error log here:
2017-01-20 21:40:03 7fff79bb0000 InnoDB: Operating system error
number 2 in a file operation. InnoDB: The error means the system
cannot find the path specified. InnoDB: If you are installing InnoDB,
remember that you must create InnoDB: directories yourself, InnoDB
does not create them. InnoDB: Error: could not open single-table
tablespace file ./yunityproject_wordpress/wp_comments.ibd InnoDB: We
do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log
to it. InnoDB: To fix the problem and start mysqld: InnoDB: 1) If
there is a permission problem in the file and mysqld cannot InnoDB:
open the file, you should modify the permissions. InnoDB: 2) If the
table is not needed, or you can restore it from a backup, InnoDB: then
you can remove the .ibd file, and InnoDB will do a normal InnoDB:
crash recovery and ignore that table. InnoDB: 3) If the file system or
the disk is broken, and you cannot remove InnoDB: the .ibd file, you
can set innodb_force_recovery > 0 in my.cnf InnoDB: and force InnoDB
to continue crash recovery here. 170120 21:40:04 mysqld_safe mysqld
from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
Just had this issue. Turns out a mysql.pid file was missing from the mamp\tmp\mysql\ folder. uninstalled, reinstalled and everything works. just make sure you delete the old mamp folder.
[coincidence? my mamp-pro license just expired and then this issue happened]

Cannot start mysql after restart on Yosemite

I'm having a problem that appears to be fairly commonplace, though having read around and attempted numerous solutions I'm quite confused as to what's going on here. The crux of the problem is, ever time I restart my Mac (running on OS X Yosemite 10.10.3) after installing MySQL it cannot connect, start or function, with the following message displayed ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2).
I have installed MySQL using brew, where it resides in /usr/local/Cellar/mysql/5.6.26/. When I run mysqld_safe from here it quits each time, failing to start. I've looked at the error file and these are the error messages:
2015-09-16 10:43:27 7fff77882300 InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
2015-09-16 10:43:27 1421 [ERROR] InnoDB: Could not find a valid tablespace file for 'bespokedb/concept_terms'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2015-09-16 10:43:27 1421 [ERROR] InnoDB: Tablespace open failed for '"bespokedb"."concept_terms"', ignored.
2015-09-16 10:43:27 7fff77882300 InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
2015-09-16 10:43:27 1421 [ERROR] InnoDB: Could not find a valid tablespace file for 'bespokedb/terms'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2015-09-16 10:43:27 1421 [ERROR] InnoDB: Tablespace open failed for '"bespokedb"."terms"', ignored.
2015-09-16 10:43:27 1421 [Note] InnoDB: 128 rollback segment(s) are active.
2015-09-16 10:43:27 1421 [Note] InnoDB: Waiting for purge to start
2015-09-16 10:43:27 1421 [Note] InnoDB: 5.6.26 started; log sequence number 12730080990
Warning: World-writable config file './auto.cnf' is ignored /usr/local/Cellar/mysql/5.6.26/bin/mysqld: Error on delete of './auto.cnf' (Errcode: 13 - Permission denied)
2015-09-16 10:43:27 1421 [Warning] World-writable config file './auto.cnf' has been removed.
Warning: World-writable config file './auto.cnf' is ignored
2015-09-16 10:43:27 1421 [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: 617f6dd0-5c57-11e5-a7aa-9c9a2e17ea50.
I have tried making the mysql data dir (which is in /usr/local/var/mysql) folders and files read, write and executable (a bit naughty I know). I've also tried creating a sim link for the mysql.sock in /var/mysql/. Aside from that I've uninstalled and reinstalled mysql numerous times and have followed many routines detailed online on how to remove/add startup items. All in all, this seems very overcomplicated for a very widely used piece of kit on a very widely used operating system. If somebody would be very kind to go into some detail here about how these problems might be arising / why this process isn't more simple that would be brilliant. I only want to learn!
Thanks,
Dan

Error 1067: The process terminated unexpectedly [InnoDB]

I am facing the following error when i try to restart the MySQL service after an unexpected shutdown of the database server last night.
Could not start the MySQL service on Local Computer.
Error 1067: The process terminated unexpectedly.
When i check the .err log file under MySql data folder, the log details are as per below.
InnoDB: Log scan progressed past the checkpoint lsn 804 2135184621
150513 12:20:39 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 804 2136195241
150513 12:20:50 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 0 1 2 3 150513 12:20:50 InnoDB: Assertion failure in thread 2412 in file .\rem\rem0rec.c line 337
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.1/en/forcing-recovery.html
InnoDB: about forcing recovery.
150513 12:20:51 - mysqld got exception 0xc0000005 ;
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=135266304
read_buffer_size=65536
max_used_connections=0
max_threads=400
threads_connected=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 262617 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
thd: 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...
InnoDB: Thread 164 stopped in file .\os\os0sync.c line 391
0070A1A8 mysqld.exe!rec_get_offsets_func()[rem0rec.c:337]
0071B498 mysqld.exe!page_cur_parse_insert_rec()[page0cur.c:798]
0071512F mysqld.exe!recv_parse_or_apply_log_rec_body()[log0recv.c:814]
00715CF1 mysqld.exe!recv_recover_page()[log0recv.c:1294]
006EBE0F mysqld.exe!buf_page_io_complete()[buf0buf.c:2033]
006E4472 mysqld.exe!fil_aio_wait()[fil0fil.c:4273]
006BCDCD mysqld.exe!io_handler_thread()[srv0start.c:437]
77E6482F kernel32.dll!GetModuleHandleA()
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.
Error log show in Event Viewer:
An unhandled win32 exception occurred in mysqld.exe [1200]. Just-In-Time debugging this exception failed with the following error: Debugger could not be started because no user is logged on.
MySQL version: 5.1<br>
Table Type: InnoDB<br>
ibdata1 Size: 28GB
There are no SQL dump backup files for the tables made and there is only the SQL physical data files. I am desperately needed to restore the data of these and bring the website back to online.
Please help.
Apparently this is a known bug within MySQL 5.1 as mentioned within a few bug docs below.
http://bugs.mysql.com/bug.php?id=44416
http://bugs.mysql.com/bug.php?id=45844
I have updated the MySQL version to the latest (5.1.73) and then force recovery the InnoDB at level 6 (can only be started at this level for my case). After that, i can proceed with mysqldump.
setting file my.ini
change or add setting
innodb_flush_method=normal
restart service mysql

Getting error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed" when starting MySQL

I found many similar question on Stackoverflow but didn't get the exact error solution.
My issue is when starting MySQL service on one of the Dedicated Centos 6.5 machine, I am getting error :
141018 05:13:46 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
141018 5:13:47 [Warning] Can't create test file /var/lib/mysql/ip-184-168-73-83.lower-test
141018 5:13:47 [Warning] Can't create test file /var/lib/mysql/ip-184-168-73-83.lower-test
/usr/libexec/mysqld: Can't create/write to file '/tmp/ibkTWnhE' (Errcode: 28)
141018 5:13:48 InnoDB: Error: unable to create temporary file; errno: 28
141018 5:13:48 [ERROR] Plugin 'InnoDB' init function returned error.
141018 5:13:48 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
141018 5:13:48 [ERROR] Can't start server : Bind on unix socket: No space left on device
141018 5:13:48 [ERROR] Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?
141018 5:13:48 [ERROR] Aborting
141018 5:13:48 [Note] /usr/libexec/mysqld: Shutdown complete
141018 05:13:48 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Here are free command status:
free -m
total used free shared buffers cached
Mem: 3743 3631 111 0 2705 21
-/+ buffers/cache: 905 2838
Swap: 2047 0 2047
This error also happens when your Database data is corrupt. You may fix this issue by moving your Db data files (ib_logfile0 and ib_logfile1) mentioned below to another location. ib_logfile0 and ib_logfile1 are system tablespace for the InnoDB infrastructure. These files contains several classes for information vital for InnoDB. You may read about these files here.
Before following below steps please keep a copy of files (ib_logfile0 and ib_logfile1) so you may restore your data in case it is lost:
Follow below steps:
Login to server via SSH with root access.
Navigate to /var/lib/mysql.
If you see files like, ib_logfile0 and ib_logfile1, rename or move them to some other folder.
Stop and start the MySQL service by running sudo service mysql stop and sudo service mysql start
These files will be recreated after you restart the server and the issue will be fixed hopefully.
Thanks
I have the same problems, this my solution:
Add more RAM to the server
Decrease the value of innodb-buffer-pool size in the config file:
sudo nano /etc/mysql/my.cnf
innodb_buffer_pool_size = 10M
After save /etc/mysql/my.cnf.
Restart mysql service:
sudo service mysql restart
exit
This is frequently occurred issue. Do following -
delete/move out these "aria_log_contro, ib_logfile0, ib_logfile1, ib_data1" files from location "..\xampp\mysql\data" and also from "..\xampp\mysql\backup".
stop and start apache server and mysql form xampp control panel
This should fix the issue; actually it worked for me.
NOTE: THIS IS GOING TO RESET THE DB IN MANY CASES BE VERY CAREFUL
Changing the values of innodb_buffer_pool_size and innodb_log_file_size didn't work for me.
Moving ib_logfile0 and ib_logfile1 files didn't help either.
What did help was:
> service mysql stop
Edit my.cfg and add innodb_force_recovery = 1
> service mysql start
> service mysql stop
Comment the innodb_force_recovery = 1 line.
> service mysql start
And voilá. (I should note that I have no idea if this involves any data loss or not)
Although late but putting answer here so that solution that helped me can help someone. I took following steps:
Added more RAM to sever
Decrease the value of innodb-buffer-pool size
Set innodb_log_file_size
Restart mysql
Example of addition to my.cnf:
innodb_buffer_pool_size = 10M
innodb_log_file_size = 1000M
After few unsuccess hours, i checked the disk space... and was full...
I was getting below mysql error log:-
[Note] Plugin 'FEDERATED' is disabled.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Using Linux native AIO
InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
InnoDB: Completed initialization of buffer pool
InnoDB: Fatal error: cannot allocate memory for the buffer pool
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting
[Note] /usr/libexec/mysqld: Shutdown complete
I found out there are two solutions which are:-
1)Set innodb_log_file_size equal to the actual size of the existing InnoDB log files.
To see what size of innoDB log allocated, login mysql and enter following cmd:-
SHOW GLOBAL VARIABLES LIKE 'innodb_log_file_size';
Expected result example:- 5242880
After that, insert that value in my.cnf:-
vi /etc/my.cnf
innodb_log_file_size =5242880
2)Rename or move both the ./ib_logfile0 and ./ib_logfile1 files, and then start the MySQL server.This normally will be located at /var/lib/mysql. After start mysql, it create new innoDB log file and restore possible half-written data from the file of .ibd.
The expexted mysql log example:-
InnoDB: Database physically writes the file full: wait...
161216 9:58:54 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
161216 9:58:54 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
161216 9:58:54 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
161216 9:58:54 InnoDB: Waiting for the background threads to start
161216 9:58:55 InnoDB: 5.5.50 started; log sequence number 1589772
161216 9:58:55 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
161216 9:58:55 [Note] - '0.0.0.0' resolves to '0.0.0.0';
161216 9:58:55 [Note] Server socket created on IP: '0.0.0.0'.
161216 9:58:55 [Note] Event Scheduler: Loaded 0 events
161216 9:58:55 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.50' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL) by Remi
References:-
JUSTIN KULESZA (2011). MySQL: Failed Registration of InnoDB as a Storage Engine. Available at: https://spin.atomicobject.com/2011/05/09/mysql-failed-registration-of-innodb-as-a-storage-engine/.
RolandoMySQLDBA (2014). MySQL my.cnf: innodb_log_file_size is missing. Available at: https://dba.stackexchange.com/questions/75688/mysql-my-cnf-innodb-log-file-size-is-missing/158325#158325
Changing the Number or Size of InnoDB Redo Log Files. Available at: http://dev.mysql.com/doc/refman/5.7/en/innodb-data-log-reconfiguration.html
Nothing was working with reinstalls, removes, and others (I had no data to keep, not a fix; more of a data destruction process, big caveat there):
1005 mysql_install_db
1007 /usr/bin/mysqld_safe --datadir='/var/lib/mysql
1008 /usr/bin/mysqld_safe --datadir='/var/lib/mysql' (^z)
1009 bg
1010 mysql
1011 mysql_secure_installation
1012 mysql
1013 mysql -p
And viola; actually usable database.
for me the solution was to change the config to add
innodb_use_native_aio = 0
in mysql config
Just move this log file (ib_logfile0) to some other place for safer side and start the mysql services it worked for me.
I also met the same issue when restore a backup set made via innobackupex to a new instance. Finally ,the root cause is innodb_log_file_size doesn't match original instance that take the backup, and fix steps by steps like below:
Get innodb_log_file_size value from oragin instance via below command:
mysql uroot -ppasswd -NBe "show global variables like 'innodb_log_file_size';"
Modify the /etc/my.cnf of new instance with last get value:
vim /etc/my.cnf
Restart mysqld via :
systemctl restart mysqld

Checking for tables which need an upgrade, are corrupt or were not closed cleanly

I am running mysql on my EC2 and when I tried to do:
sudo /etc/init.d/mysql restart
I got this:
Stopping MySQL database server mysqld
Starting MySQL database server mysqld
Checking for tables which need an upgrade, are corrupt or were not closed cleanly.
Here is what is in my /var/log/mysql/error.log
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
140406 1:47:27 InnoDB: Unable to open the first data file
InnoDB: Error in opening ./ibdata1
140406 1:47:27 InnoDB: Operating system error number 11 in a file operation.
InnoDB: Error number 11 means 'Resource temporarily unavailable'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/operating-system-error-codes.html
140406 1:47:27 InnoDB: Could not open or create data files.
140406 1:47:27 InnoDB: If you tried to add new data files, and it failed here,
140406 1:47:27 InnoDB: you should now edit innodb_data_file_path in my.cnf back
140406 1:47:27 InnoDB: to what it was, and remove the new ibdata files InnoDB created
140406 1:47:27 InnoDB: in this failed attempt. InnoDB only wrote those files full of
140406 1:47:27 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
140406 1:47:27 InnoDB: remove old data files which contain your precious data!
140406 1:47:27 [ERROR] Plugin 'InnoDB' init function returned error.
140406 1:47:27 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140406 1:47:27 [ERROR] Unknown/unsupported storage engine: InnoDB
140406 1:47:27 [ERROR] Aborting
140406 1:47:27 [Note] /usr/sbin/mysqld: Shutdown complete
140406 01:47:27 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Could someone please tell me what is going on?
Thanks
Looks you have a mysql process running. There's a lock on your ./ibdata1 file. it could be that for some reason your service mysql stop command is not stopping the process as it may not be finding the PID of your mysql server.
Run from the command line:
ps -Af | grep mysql
Get the PID of your mysql process and then simply:
kill -9 <PID of your mysql process>
cd /var/lib/mysql
#killall -9 mysqld
#innochecksum -d ibdata1
nano /etc/mysql/my.cnf
[mysqld]
innodb_force_recovery = 4
/etc/init.d/mysql start