MAMP4 not launching MySQL - mysql

Downloaded MAMP4 and installed over MAMP1.9.4 (I know, it's old) with Mac OSX Sierra. Apache server launches, but not MySQL. Warned that previous db was copied to a folder named mysql56 and that on starting up MySQL need to convert db. But MySQL doesn't even start up! Activity Monitor shows no other mysql process going on. MAMP error log:
2017-01-16 12:35:13 47394 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!
2017-01-16 12:35:13 47394 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2017-01-16 12:35:13 47394 [ERROR] Plugin 'InnoDB' init function returned error.
2017-01-16 12:35:13 47394 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-01-16 12:35:13 47394 [ERROR] Unknown/unsupported storage engine: InnoDB
2017-01-16 12:35:13 47394 [ERROR] Aborting
I tried using the same ports as I used with MAMP1.9.4 (80 & 3306), then switched to default. Webserver address was pointing to my directory where I keep my websites. Changed it back to Applications/MAMP/htdocs. Nothing is working. :( Any help would be very much appreciated.
Oh, on my old machine running Snow Leopard, it's all still working with MAMP1.9.4.

Found the solution at http://rat32.com/rat32/2016/11/29/how-to-solve-mysql-not-starting-in-mamp-problem/#comment-175889. Removed all files except folders from Applications/MAMP/db/mysql56. Then restarted. MAMP immediately connected to the MySQL server and prompted me to upgrade my databases. All is well.
I tried other suggestions. The most common was to check for any other MySQL processes that might be running and to kill them via Terminal command. Another suggestion was to rename the files ib_logfile0 and ib_logfile1 in /Library/Application Support/MAMP PRO/db/mysql56, but as I had not initiated MAMP PRO, that folder did not exist. I had renamed the two files in Applications/MAMP/db/mysql56, but that didn't solve the problem. Only when I actually removed those two files and a third, then MAMP was able to connect to the MySQL server.
So it seems silly to answer my own question, but just want to put it here in case others run into the same problem.
Using MAMP 4.1 with Mac OSX Sierra.

Related

Mysqld changes pid

I have this really strange problem.
To give you some context, I've have a script that setsup my dev env which contains mysql and percona server and some other things using brew on OSX.
I've re-runned it to do some reconfiguration that got messed up.
But after the re-run mysql won't stay up. Every time I check the mysqld pid I get a different result. I checked the mysql logs and the problem is "mysqld_safe A mysqld process already exists".
So I decided to delete everything related to mysql. I followed the gist from https://gist.github.com/vitorbritto/0555879fe4414d18569d but somehow, the mysql and mysqld process still starts after I restart my laptop.
How is this possible? Has anyone else had this problem? How do I fix it without reinstalling OSX?
So tadman was right. I managed to get my environment to work, I still don't know what that zombie process is, but because it's not affecting me, I don't care.
The problem was that my script was installing the latest version of MySQL and percona-server#5.6. and there is a conflict with InnoDB.
After reinstalling manually everything in the MySQL log there was something along the lines:
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting
After installing MySQL#5.6 everything seems to work as expected.
Thanks tadman.

Recovering MySQL Database From Data Directories

I am trying to recover a MySQL database from data directories. I do have a backup, but it is a week old and I would prefer not to use it.
I have transferred all of the files to a fresh MySQL installation and have given them 777 permissions along with directory and group ownership to mysql.
When I try to start, I get the following two errors:
InnoDB: Error: log file ./ib_logfile0 is of different size 0 0 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
and
170110 16:42:58 [ERROR] Plugin 'InnoDB' init function returned error.
170110 16:42:58 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
For the first error, I have tried specifying the log file size in the my.cnf and also as an argument to mysqld. I keep getting the same error message.
For the second error, I have tried deleting the ib_logfile0 and ib_logfile1, but if I do, I get a bunch of nonsensical characters when starting mysqld followed by
/usr/sbin/mysqld(+0x286668)[0x7f65298d4668]
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.
How can I retrieve the data in this database?

Maddening Intermittent Wordpress: Error establishing database connection

Every day or so our Wordpress sites stop responding, the pages begin returning the dreaded 'Error establishing database connection'. There is nothing in the MySQL logs, and I'm at a loss as to what could be causing the issue. We don't have a lot of site visitors, and the machine is a Medium EC2 instance. Anyone have any ideas on how to resolve this?
There's not a whole lot to work with here. But ... I had the same issue with my micro instance. My problem was that the server kept running out of memory and then the mysql server would stop. It would start again when restarting the computer but it was only a matter of time before it would crash again.
Here's what I was getting in my MySQL logs.
151023 6:15:44 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
151023 6:15:44 InnoDB: Completed initialization of buffer pool
151023 6:15:44 InnoDB: Fatal error: cannot allocate memory for the buffer pool
151023 6:15:44 [ERROR] Plugin 'InnoDB' init function returned error.
151023 6:15:44 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
151023 6:15:44 [ERROR] Unknown/unsupported storage engine: InnoDB
151023 6:15:44 [ERROR] Aborting
You might want to check for something similar. I use Ubuntu and the log is at /var/log/mysql/ by default.
I solved the problem by setting up a swap file as per Amazon EC2, mysql aborting start because InnoDB: mmap (x bytes) failed; errno 12. The AWS instances don't come with a swap space setup by default (whereas the install I downloaded from Ubuntu back in the day did). You need to set it up manually. Here's the method -
ssh into your AWS instance. Then:
Run dd if=/dev/zero of=/swapfile bs=1M count=1024
Run mkswap /swapfile
Run swapon /swapfile
Add this line /swapfile swap swap defaults 0 0 to /etc/fstab
Read the linked question for more details. Hope that helps!
I had a similar issue with intermittent crashing of MySQL. It turned out to be Apache configurations. Bots were brute forcing the site and eventually caused Apache to crash (check your logs: $ cat /var/log/apache2/access.log). Apache automatically restarts, but there isn't enough spare memory to restart MySQL too, hence the Database Connection error. The short fix is to reduce the number of RequestWorkers in Apache to better fit the amount of RAM you have.
You can run a diagnostic on your apache configuration using Apache2Buddy. It'll calculate how many Apache Workers you can run given the amount of RAM you have and how big your application is:
$ curl -L http://apache2buddy.pl/ | perl
It's probably going to recommend changing MaxRequestWorkers (or MaxClients on older Apache systems) in your MPM-Prefork configurations. That file is at /etc/apache2/mods-available/mpm_prefork.conf on my system. After changing the value to what Apache2Buddy recommends, just restart Apache and you should be good to go.
I wrote an article on this situation if you want a deeper explanation, a method to stress test, or ideas on how to block some of the bot traffic: http://brunzino.github.io/blog/2016/05/21/solution-how-to-debug-intermittent-error-establishing-database-connection/
When I tried to install local wordpress the same error
error establishing database connection
occurred because I forget to stop the SQL and Apache which was started in xampp. I stopped it and reinstalled the wordpress for Windows and it worked.

XAMPP: MYSQL stops working after I restart

I am having problems with starting MYSQL in XAMPP. Apache starts alright but then MYSQL keeps reporting an unexpected shutdown.
I was led to delete C:\xampp\mysql\data\ibdata1 and it works after that but that deletes all my databases and MYSQL stops working again after I restart my machine.
I went through the error logs and this is what I saw:
[ERROR] InnoDB: Attempted to open a previously opened tablespace.
Previous tablespace mysql/innodb_index_stats uses space ID: 2 at
filepath: .\mysql\innodb_index_stats.ibd. Cannot open tablespace
yiicrud/customer which uses space ID: 2 at filepath:
.\yiicrud\customer.ibd InnoDB: Error: could not open single-table
tablespace file .\yiicrud\customer.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.
Adding this line in my.cnf worked for me:
innodb_force_recovery = 1
There is a solution on this page: XAMPP/MySQL: could not open single-table tablespace file .\mysql\innodb_index_stats.ibd after restart of MySQL
Move (DON'T DELETE) those files, into another folder:
innodb_index_stats.frm <br>
innodb_table_stats.frm <br>
slave_worker_info.frm <br>
slave_master_info.frm <br>
slave_relay_log_info.frm <br>
and .ibd files with the same filename.
Try start MySQL.
Thanks a lot everyone.
I have able to solve it. It appears the database was created in a later version and was incompatible with this new version of xampp so i created the databases again and imported the tables into them. Previously I was importing the database with the create statements as well.
Had the idea from Salman's comment.
Try this
rename the XAMMP\mysql\data folder to any other name you wish (say data_old )
make a new folder in XAMMP\mysql name data and copy all the files in it including ibdata1
close all running programs and restart XAMPP
No need to copy files from data_old but if you do have previously constructed databases then you may copy some files from data_old.
The solution may come again. If it then you have to change the port to something else like 3308 in the config settings as well as in phpMyAdmin/config.inc.php.
If the problem stays still then its better to change the application which uses the port 3306 and set default settings in XAMPP.

mysql in xampp starts and stops in five seconds

I installed xampp in windows XP. I am able to start apache and tomcat. But when I start mysql, it gets started but stops after five seconds.
So, I am not able to work with PHPMyAdmin.
I checked the mysql_error file inside xampp/mysql/bin and the following was present.
120320 11:48:44 [Note] Plugin 'FEDERATED' is disabled.
120320 11:48:44 InnoDB: The InnoDB memory heap is disabled
120320 11:48:44 InnoDB: Mutexes and rw_locks use Windows interlocked functions
120320 11:48:44 InnoDB: Compressed tables use zlib 1.2.3
120320 11:48:45 InnoDB: Initializing buffer pool, size = 16.0M
120320 11:48:45 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file C:\xampp\mysql\data\ibdata1 did not exist:
InnoDB: a new database to be created!
120320 11:48:45 InnoDB: Setting file C:\xampp\mysql\data\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
120320 11:48:45 InnoDB: Log file C:\xampp\mysql\data\ib_logfile0 did not exist: new to be created
InnoDB: Setting log file C:\xampp\mysql\data\ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
120320 11:48:45 InnoDB: Log file C:\xampp\mysql\data\ib_logfile1 did not exist: new to be created
InnoDB: Setting log file C:\xampp\mysql\data\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
120320 11:48:48 InnoDB: Waiting for the background threads to start
120320 11:48:49 InnoDB: 1.1.8 started; log sequence number 0
120320 11:48:52 [Note] Event Scheduler: Loaded 0 events
120320 11:48:52 [Note] mysql\bin\mysqld.exe: ready for connections.
Version: '5.5.16' socket: '' port: 3306 MySQL Community Server (GPL)
I am using xampp 1.7.7
please help...
This worked for me,
quit the XAMPP
cut the All files in C:\xampp\mysql\backup
paste and replace files in C:\xampp\mysql\data
run as administrator the XAMPP
i had the same problem and i have found a temporary solution by going to the installation folder
xampp->mysql->bin-> mysqld.exe file
running the mysqld.exe file
my xampp mysql service restarted successfully
I'm not sure if this will also work for your case, but it surely did for me, and I've yet to encounter the answer here.
go to Xampp/mysql/bin/my.ini
add the following line:
innodb_force_recovery = 1
(I think anything > 0 works here, also... it might be handy to make a backup of the file just to be on the safe side.)
You should now be able to successfully start your mySQL service.
This is an alternate solution instead of solving the above problem. I think you used windows installer for xampp, instead of that Download the zip file and keep it under c:\xampp. Use this link for downloading in zip format.
http://www.apachefriends.org/download.php?xampp-win32-1.7.7-VC9.zip
If you feel the zip file format is huge. Use 7zip file format.
http://www.apachefriends.org/download.php?xampp-win32-1.7.7-VC9.7z
Earlier I used to have same problem, solved it in this way.
Did you by any chance update your old install and then copy/paste your old 'htdocs' and 'mysql data' files to the upgrade files?
Have just run into the same problem, which I solved by uninstalling then re installing. Copying only my Htdocs over then re building my database... A pain but as I am only in Development and using Symfony2 rebuilding my database with fixtures was pretty painless.
Hope this is of some help.
Doug.
I had a similar problem that was caused by the TCP port needed for one for the services already being used by another application. In my case it was Skype using ports 80 and 443 as fall-back.
You can check if any of the needed TCP ports are used by another application by running the following at the command prompt:
c:>netstat /a
The offending connection will be listed as "LISTENING" in state STATE column. Then it's up to you to figure out what application is using the port. There is a nice tool called portmon for that.
The ports you'll need are 80, 3360... (anyone can expand on this?)
This is how I solved it:
xampp control panel > config > service & port settings > apache > mainport > 80 (default) change to 81.
open xampp > apache > cnonf > httpd.conf
3 search for ServerName localhost:80 change to ServerName localhost:81
search for Listen 80 change to Listen 81
Start Xampp > apache
open http://localhost:81/phpmyadmin/
whoaa its working
This worked for me, actually checking the 'mysql' service is not disabled. Turns out it was disabled.
how to check?
windows + R (opens run window)
type in services.msc
check if the service mysql is set as disabled. (change it to automatic)
This helped me with my unknown Phpmyadmin not starting issue.
If nothing helps, follow the steps mentioned in the below link. There are 3 methods to solve the problem. I hope, it will help you as well :)
For your convenience, I am writing down the steps of one of the methods which helped me to solved the problem
First of all stop all the services running in xampp control panel
Go to xampp > mysql >
Rename the data folder to anything else, such as data-old.
Then rename the backup folder to data
That's it. Try starting apache and mysql services from xampp control panel. Go to the link mentioned below to learn more.
https://kinsta.com/knowledgebase/xampp-mysql-shutdown-unexpectedly/