MAMP Pro can't start MySQL - mysql

I had to force a shutdown when my computer froze, and MAMP has been unable to start MySql since then. I have tried deleting the log files from MAMP/DB/mysql and restarting MAMP, but it hasn't worked. I also tried entering sudo killall -9 mysqld in the terminal, to no avail.
Here is the error log from MAMP:
2017-05-12 16:05:49 4691 [Note] InnoDB: The log sequence numbers 730255276 and 730255276 in ibdata files do not match the log sequence number 730624549 in the ib_logfiles!2017-05-12 16:05:49 4691 [Note] InnoDB: Database was not shutdown normally!
2017-05-12 16:05:49 4691 [Note] InnoDB: Starting crash recovery.
2017-05-12 16:05:49 4691 [Note] InnoDB: Reading tablespace information from the .ibd files...
2017-05-12 16:05:50 4691 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace mysql/slave_worker_info uses space ID: 5 at filepath: ./mysql/slave_worker_info.ibd. Cannot open tablespace wordpress#0020test#0020site/wp_term_taxonomy which uses space ID: 5 at filepath: ./wordpress#0020test#0020site/wp_term_taxonomy.ibd
2017-05-12 16:05:50 7fff7303b000 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 ./wordpress#0020test#0020site/wp_term_taxonomy.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.
170512 16:05:50 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
Any ideas?

I've just had the same problem with MAMP.
To solve the problem, i was forced to delete the file that causes the error located in "Applications/MAMP/db/mysql56/bib" and then recreate the TABLE/BASE afterwards.
I hope that would be helpful.

Related

MAMP Pro mysql can't start

I'm having problem can't find way to fix this. I get this error
2017-01-11 23:58:25 7fffbac563c0 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 ./mysql/innodb_index_stats.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.
170111 23:58:26 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
Any suggestion how can I fix this?
Thanks
You can edit MySQL my.cnf solve this problem.
find: file -> edit template -> MYsql(my.cnf)
find: 'innodb_force_recovery' = 1
Hope to help you!

XAMPP: MySQL does not start after crash

There are aready several questions regarding that MySQL fails to start when running XAMPP, but unfortunately I couldn't figure out a solution from these.
Here is my case:
I installed XAMPP for Linux 5.6.14-3 and when I ran it yesterday everything worked fine.
Today, I ran XAMPP again:
/opt/lampp$ sudo ./xampp start
Starting XAMPP for Linux 5.6.14-3...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
Then I open localhost in the browser bringing me to the xampp dashboard. There I click on the phpMyAdmin menu entry, which gives me:
Error
MySQL said:
Cannot connect: invalid settings.
Connection for controluser as defined in your configuration failed.
phpMyAdmin tried to connect to the MySQL server,
and the server rejected the connection.
You should check the host, username and password
in your configuration and make sure that they
correspond to the information given by the
administrator of the MySQL server.
I think that I made sure that the control user has the right pass.
The problem rather seems to be that MySQL does not really start although it says 'ok' (see above). Since, when I stop XAMPP, I get:
/opt/lampp$ sudo ./xampp stop
Stopping XAMPP for Linux 5.6.14-3...
XAMPP: Stopping Apache...ok.
XAMPP: Stopping MySQL...not running.
XAMPP: Stopping ProFTPD...ok.
Looking at the error_log of xampp, there is a single entry, which looks suspicious (though I don't really understand it), saying:
[Sun Nov 15 11:38:59.737875 2015] [mpm_prefork:notice] [pid 6217] AH00169: caught SIGTERM, shutting down
So, if anybody is able to locate the problem or give me hints for a fix, I would really apreciate. Thanks already!
Edit - problem "fixed" (without knowing, what I've really done, though)
Here's the MySQL error-log (located at /opt/lampp/var/mysql/[computername].err):
2015-11-15 15:52:44 10864 mysqld_safe Starting mysqld daemon with databases from /opt/lampp/var/
2015-11-15 15:52:44 140410457307008 [Note] Using unique option prefix 'key_buffer' is error-prone and can break in the future. Please use the full name 'key_buffer_size' instead.
2015-11-15 15:52:44 140410457307008 [Note] /opt/lampp/sbin/mysqld (mysqld 10.1.8-MariaDB) starting as process 11011 ...
2015-11-15 15:52:44 140410457307008 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2015-11-15 15:52:44 140410457307008 [Note] InnoDB: The InnoDB memory heap is disabled
2015-11-15 15:52:44 140410457307008 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-11-15 15:52:44 140410457307008 [Note] InnoDB: Memory barrier is not used
2015-11-15 15:52:44 140410457307008 [Note] InnoDB: Compressed tables use zlib 1.2.8
2015-11-15 15:52:44 140410457307008 [Note] InnoDB: Using CPU crc32 instructions
2015-11-15 15:52:44 140410457307008 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2015-11-15 15:52:44 140410457307008 [Note] InnoDB: Completed initialization of buffer pool
2015-11-15 15:52:44 140410457307008 [Note] InnoDB: Highest supported file format is Barracuda.
2015-11-15 15:52:44 140410457307008 [Note] InnoDB: The log sequence numbers 3813213 and 3813213 in ibdata files do not match the log sequence number 9929741 in the ib_logfiles!
2015-11-15 15:52:44 140410457307008 [Note] InnoDB: Database was not shutdown normally!
2015-11-15 15:52:44 140410457307008 [Note] InnoDB: Starting crash recovery.
2015-11-15 15:52:44 140410457307008 [Note] InnoDB: Reading tablespace information from the .ibd files...
2015-11-15 15:52:44 140410457307008 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace bitnami_joomla/jos_content_frontpage uses space ID: 14 at filepath: ./bitnami_joomla/jos_content_frontpage.ibd. Cannot open tablespace phpmyadmin/pma__bookmark which uses space ID: 14 at filepath: ./phpmyadmin/pma__bookmark.ibd
2015-11-15 15:52:44 7fb3db6e3780 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 ./phpmyadmin/pma__bookmark.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.
2015-11-15 15:52:44 10864 mysqld_safe mysqld from pid file /opt/lampp/var/mysql/[computername].pid ended
First try: I made a backup of the directory /opt/lampp/var/mysql/phpmyadmin/ and added
innodb_force_recovery = 1
at the end of /opt/lampp/etc/my.conf. That gave me still the same error when starting MySQL again.
Next try was removing the file pma__bookmarks.idb from the directory, which had the effect that the error now complained about pma__favorites instead.
Finally, I removed all pma__*.idb-files and voila! MySQL is running, and I can access the phpMyAdmin-pages.
Works for me, though I don't know what was lost be removing the pma-databases? (They were not restored in any way, as it seems...)
Probably, the database-files were corrupted, when my computer went down, and they were still running!?
You must check whether mysqld process exist in top and then either try to connect with mysql command line client or review MySQL Error log. Sometimes xampp may be confused by MySQL Server which e.g. comes pre-installed with OS.

Error Starting MySQL after Crash

I was merrily installing wordpress with MAMP pro when my Mac crashed. Now I cannot start MySql. Most stuff I read online tells me to throw some terminal commands at it, trying to kill the process.
killall -9 mysqld
But terminal report "No matching processes belonging to you were found"
So I have had a look in the log and can see this from the time of the first restart attempt after the crash
150506 21:11:33 mysqld_safe Starting mysqld daemon with databases from /Library/Application Support/appsolute/MAMP PRO/db/mysql
150506 21:11:33 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
150506 21:11:33 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql/ is case insensitive
150506 21:11:33 [Note] Plugin 'FEDERATED' is disabled.
150506 21:11:33 InnoDB: The InnoDB memory heap is disabled
150506 21:11:33 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150506 21:11:33 InnoDB: Compressed tables use zlib 1.2.3
150506 21:11:33 InnoDB: Initializing buffer pool, size = 128.0M
150506 21:11:33 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
150506 21:11:33 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
150506 21:11:33 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
150506 21:11:33 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...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
150506 21:11:34 InnoDB: Waiting for the background threads to start
150506 21:11:35 InnoDB: 5.5.42 started; log sequence number 0
150506 21:11:35 [Note] Event Scheduler: Loaded 0 events
150506 21:11:35 [Note] /Applications/MAMP/Library/bin/mysqld: ready for connections.
Version: '5.5.42' socket: '/Applications/MAMP/tmp/mysql/mysql.sock' port: 0 Source distribution
150506 21:16:44 [Note] /Applications/MAMP/Library/bin/mysqld: Normal shutdown
So Table Space size error.. I am very much a front end guy and have no idea where to begin with this...??
Help please, I really can't afford to loose the last week of work.
Thanks you
As you pointed out InnoDB tablespace is corrupt, so InnoDB fails to start.
InnoDB can tolerate some errors if you start it with option innodb_force_recovery. Try values from 1 to 6 until MySQL starts.
If you're lucky and MySQL starts with innodb_force_recovery then dump all tables into an sql file with mysqldump and re-create MySQL database from scratch. I.e. move existing files to some safe place, start mysql_install_db, change file permissions and start MySQL. Then load the database back.
If you're less lucky and MySQL doesn't start with innodb_force_recovery=6 then check how to Recover Corrupt MySQL Database .
And to avoid this experience in future use XtraBackup for Mac OS to take backups.
Please see her:
MAMP PRO crashes; MySQL will not start on reboot
Thanks for the heads up with Xtrabackup for MacOS, one to keep an eye on that.

MySQL refusing to start

I recently upgraded XAMPP, and (stupidly, probably) simply copied my old mysql/data folder into the new installation. I'm not sure what version of MySQL I was running before, but it was probably 5.1. The new version is 5.6. Whenever I start MySQL now, I get this error:
2014-11-05 23:31:04 8784 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace db_name/table_name uses space ID: 2 at filepath: .\db_name\table_name.ibd. Cannot open tablespace mysql/innodb_index_stats which uses space ID: 2 at filepath: .\mysql\innodb_index_stats.ibd
InnoDB: Error: could not open single-table tablespace file .\mysql\innodb_index_stats.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.
I know from this question and others that deleting the ibdata1 and ib_logfile0 files temporarily solves this problem, but I need to do it each time I start XAMPP / MySQL. Is there a way to fix this problem permanently?

recover mysql database from ibdata1

I have a client who appears to have lost all of their mysql databases from their local machine. They are on a Mac, which I am somewhat unfamiliar with and I am on Ubuntu. There were no .MYD or .MYI files in the database folder, only .frm ones. I had them zip up the mysql and sight folders (with sight being the database we need), and the ibdata1, ib_logfile0, and ib_logfile1 files. I created a second folder for mysql, /var/lib/mysql2, and moved the files and folders into there. I chowned the new folder and files to mysql:mysql, edited /etc/mysql/my.cnf to point to the new folder, edited /etc/apparmor.d/usr.sbin.mysqld, and then restarted apparmor and mysql. However, I am getting the following errors in the mysql error log:
130308 17:38:16 [Note] Plugin 'FEDERATED' is disabled.
130308 17:38:16 InnoDB: Initializing buffer pool, size = 8.0M
130308 17:38:16 InnoDB: Completed initialization of buffer pool
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130308 17:38:16 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...
130308 17:38:16 InnoDB: Error: space id and page n:o stored in the page
InnoDB: read in are 0:589824, should be 0:7!
130308 17:38:16 InnoDB: Error: page 589824 log sequence number 786432 0
InnoDB: is in the future! Current system log sequence number 0 63932940.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html
InnoDB: for more information.
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 7.
InnoDB: You may have to recover from a backup.
130308 17:38:16 InnoDB: Page dump in ascii and hex (16384 bytes):
len 16384; hex 0008000000090000000a0000000b0000000c00000000000000000000000202720000 (snipped because this goes on for a while)
Tg 9 <o q E i F / D ;InnoDB: End of page dump
130308 17:38:16 InnoDB: Page checksum 4146777650, prior-to-4.0.14-form checksum 1800374066
InnoDB: stored checksum 524288, prior-to-4.0.14-form stored checksum 0
InnoDB: Page lsn 786432 0, low 4 bytes of lsn at page end 0
InnoDB: Page number (if stored to page already) 589824,
InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 0
InnoDB: Page may be a freshly allocated page
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 7.
InnoDB: You may have to recover from a backup.
InnoDB: It is also possible that your operating
InnoDB: system has corrupted its own file cache
InnoDB: and rebooting your computer removes the
InnoDB: error.
InnoDB: If the corrupt page is an index page
InnoDB: you can also try to fix the corruption
InnoDB: by dumping, dropping, and reimporting
InnoDB: the corrupt table. You can use CHECK
InnoDB: TABLE to scan your table for corruption.
InnoDB: See also http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
InnoDB: Ending processing because of a corrupt database page.
I have tried adding innodb_force_recovery = 4 to the my.cnf file, which generates a whole slew of different errors:
130308 17:48:30 [Note] Plugin 'FEDERATED' is disabled.
130308 17:48:30 InnoDB: Initializing buffer pool, size = 8.0M
130308 17:48:30 InnoDB: Completed initialization of buffer pool
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130308 17:48:30 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...
130308 17:48:30 InnoDB: Error: space id and page n:o stored in the page
InnoDB: read in are 0:589824, should be 0:7!
130308 17:48:30 InnoDB: Error: page 589824 log sequence number 786432 0
InnoDB: is in the future! Current system log sequence number 0 63932940.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html
InnoDB: for more information.
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 7.
InnoDB: You may have to recover from a backup.
and a whole bunch more, which I can supply if it helps. Any suggestions on what to try from here would be greatly appreciated, thanks.
Edit: I tried following the steps here, but was having issues getting mysql to run using the command line sequence he used:
http://blog.shiraj.com/2012/10/extract-data-from-mysql-ibdata1-data-file/
The following worked for my:
Set innodb_force_recovery = 1 in your my.cnf
Try and get your mysqld to restart. If not, repeat step #1 and increment
innodb_force_recovery by each until successful. Use the guide to help you understand what's happening each time you increment it: http://dev.mysql.com/doc/refman/5.0/en/forcing-innodb-recovery.html
Once mysqld is running, try and dump all your databases
mysqldump -u root -p --all-databases > /tmp/mysqldump-all.sql
If that isn't successful, you'll have to try it first on the database level
mysqldump -u root -p --databases db_name > mysqldump-db_name.sql
If that isn't successful, you'll have to try it on the table level
SELECT * FROM table_name INTO OUTFILE '/tmp/table_name.sql'
Once one of those is successful and either all your db's or all your tables are exported, stop the mysqld
Move your ib_logfile* > ib_logfile*.bak. These are typically in your mysql data directory.
If in the first step you incremented your innodb_force_recovery => 4, you need to set it below 4. As of 5.6.15, an innodb_force_recovery setting of 4 or greater places InnoDB in read-only mode.
Start the mysqld server
Import your exported databases or tables
mysql -u root -p < /tmp/mysqldump-all.sql
Incremented your innodb_force_recovery => 1
Restart the mysqld server
This is worked for me:
innodb_force_recovery => 2
Login into MySQL server using HeidiSQL and dump all database
Reinstall MySQL server and import all the database from dump file.