homebrew: MySQL not starting, Can't update PID file - mysql

I am a new Mac user and trying to set up the development environment with Apache, PHP and MySQL. Initially, after a lot of installs and reinstalls i succeeded in installing MySQL (Apache and PHP came bundled with Mac) but now again mysql refuses to start up and gives the error, The server quit without updating PID file (/usr/local/var/mysql/Nikhils-MacBook-Pro.local.pid).
I have literally gone through entire SO questions regarding this problem but have not found a way to fix this and i mean i have done everything to start this but in vain. I have created the PID file too but it disappears in moments, i did a cleanup and reinstall using this SO Question but it has failed YET again. Please, i need to get my server started, i am really losing on to serious work and time.
Is there any other miraculous way to fix this unattainable feat? Also, if anyone asks what is the error in the log files, please don't as there is no log being registered as the server hasn't started yet.

I’ve got a similar problem with MySQL on a Mac (Mac Os X Could not startup MySQL Server. Reason: 255 and “ERROR! The server quit without updating PID file”) and after a long trial and error process, finally in order to restore the file permissions, I’ve just do that:
launch the Disk Utilities.app
choose my drive on the left panel
click on the “Repair disk permissions” button
This did the trick for me. Hoping this can help someone else.

brew install mysql on mac os
These instructions helped me. There was a my.cnf in /usr/local/opt/mysql/ which seems to have been the problem for me. YMMV.

Related

mysqld won't start on fresh install on MacOS

I'm trying to get MySQL up and running for some analysis on my Mac.
MySQL version: 8.0.19
MacOS version: 10.14.6
The timeline is:
I installed MySQL successfully from https://dev.mysql.com/downloads/mysql/
It worked fine, I was able to create simple tables, etc. But when I tried to create my real schema, I realized that the default record size of 8k bytes wasn't enough; I had to increase it to the maximum, 65k bytes https://dev.mysql.com/doc/refman/8.0/en/column-count-limit.html#row-size-limits.
After reading the documentation, I learned that the row size can only be set when the database is initialized for the first time. So I wanted to start fresh, ensuring that when I first initialized the DB, the appropriate parameters were set.
So, I uninstalled MySQL using the widget in my Mac's Command Center. I rebooted, ensured no MySQL processes were running, then ran find -iname 'mysql' 2>/dev/null in the terminal, and found nothing. All traces, so far as I can tell, of MySQL were gone.
I downloaded the macOS 10.15 (x86, 64-bit), DMG Archive package again from https://dev.mysql.com/downloads/mysql/, installed it, used all the default settings in the installer, and then opened the MySQL widget from the Command Center again.
Here's where I configured the parameters. There's a place where I can put in a configuration file. So, following the advice in this How to workaround the row size limit of 66 KBytes, I created mysql.cnf in my home directory, put only these three lines in it, and put the filename in the box (checking the tickbox next to it):
innodb_page_size=64k
innodb_log_buffer_size=32M
innodb_buffer_pool_size=512M
I hit "apply". Then I went back to the other tab, hit "initialize database". No errors, seemed to work fine. Then I hit "start MySQL". The lights went briefly green, then red again. Multiple attempts, reboots, etc, don't seem to have any effect. In short, MySQL was trying to start up, but failing.
I also tried removing the mysql.cnf file, hitting "apply" and "initialize" again, and the problem is the same. I don't understand why this all worked before I uninstalled, but won't now.
I checked /var/log/system.log, and all I see is a bunch of lines noting the failure of MySQL to start:
but nowhere is the error from the application itself shown.
I did some Googling and SO'ing and looked in /usr/local/mysql/data/ as root, and I can see files that are in binary. But i do not know how to read these binary logs.
My questions:
How can I tell what error is preventing MySQL from starting?
How can I diagnose this issue? Is there a tool to read these binary files?
Does anyone know why MySQL would fail to start after a full wipe and re-install, though it was working in the first instance?
I experienced MySQL's failing to start from the System Preferences on Mac. It would turn green and red again. I also wiped and reinstalled a few times and it still wouldn't start.
In my case, I realized it was because I had AMPPS stack installed and its MySQL running at the same time. After turning off the MySQL in the AMPPS stack, I was able to start MySQL from the System Preferences successfully. Not sure if you had another software stack running that would cause the problem.

Local wordpress issues: Mac MAMP

I'm having some issues with my local environment. I had setup a wordpress site locally on my Mac through MAMP. All was working well until my computer powered down (not plugged into power source). Now there appears to be issues with the database. When i run MAMP and try to connect I get the error "Error establishing Database Connection". Also when i go through the MAMP portal at localhost and click on Tools > PHPMyAdmin I get the following error:
MySQL said: Documentation
#2002 - No such file or directory — The server is not responding (or the local server's socket is not correctly configured).
mysqli_real_connect(): (HY000/2002): No such file or directory
Obviously something has gone very wrong with the database connection but do not know how to resolve. I have tried to run some scripts in terminal to stop mysql process to no avail so far.
Any advise appreciated. I have looked at some similar but not exact other posts and does not seem to resolve.
Note: The ports changed at some point in the process, but everything else seems fine related to the new port setup but this may be relevant
thanks
While, I'm not sure of the cause. FINALLY found a solution to this very frustrating issue.
What ended up working for me is to uninstall the new version 4.2.1
I did this through first going to the MAMP PRO folder and using the MAMP Pro uninstaller and then moving the Mamp and Mamp pro folder to the trash.
I then went and found the old version to install
https://www.mamp.info/en/downloads/older-versions/
When I downloaded 3.5.2 whatever issues it was having with local databases were resolved. Go figure! Glad to finally have resolved not sure why this would happen other than perhaps a bug in the new version.
Thanks to those who pointed out some possible things to look at
I'm running MAMP 4.0.6 and getting the same error on local wordpress installations, and same error message as described when trying to go to phpmyadmin on MAMP.
The reason seemed to be that the mysql server does not start. The solution that worked for me is offered in this reply in another thread:
https://stackoverflow.com/a/45582509/4623519
Quit MAMP. In the finder go to Applications/MAMP/db/mysql/. Delete the last log file (look for a file named ib_logfileN – being N the log number Eg-ib_logfile0 and ib_logfile1) Nice screenshot provided in link above.
This seems to be happening often according to this post from 2013.

Trouble installing MySQL on Osx Mountain Lion

I'm trying to brew install MySQL on Osx 10.8.3.
I've found some posts recommending using the dmg, but I need to use the mysql2 gem, and I've read that it is better to use brew.
I've tried everything from the top two answers here:
brew install mysql on mac os
and tried this tutorial, but I still get this error:
Starting MySQL.. ERROR! The server quit without updating PID file (/usr/local/var/mysql/Thomass-MacBook-Pro-5.local.pid).
MySQL still runs (I don't really understand why), but trying to create a database gives this error:
ERROR 1006 (HY000): Can't create database 'asdf' (errno: 2)
I'm very much at a loss about what's going on, can anyone tell me what the issues here might be?
It appears that your database is either locked, or not started properly. I would suggest checking the PID at (/usr/local/var/mysql/Thomass-MacBook-Pro-5.local.pid) and either kill the process through terminal or from the PID File itself. As long as the PID is still there (whether it's asleep/zombied) you wouldn't be able to update/create a database.
You may also want to try rebooting your comp if you haven't done this step already.

MAMP Pro Error: The MySQL configuration file my.cnf couldn't be written

I tried to use MAMP Pro to replace previous XAMPP on my Mac due to its easy Virtual Hosts management. However after I installed it. The MAMP, basic version works, but the Pro version keeps given me this error message:
The MySQL configuration file my.cnf couldn't be written.
I googled for a while and there are some different solutions, like create my.cnf on /etc/, but none of these works. Also the error log is empty.
Has someone encountered this before? Or does anyone have a clue how could I solve this problem? Thank you!
I just purchased MAMP PRO and I'm having this error as well. Here's what "fixed" it:
Open Terminal and type in sudo killall -9 mysqld. You might see "No matching processes belonging to you were found," which is fine, it means that MySQL was not running.
Now, in Applications, look for the regular MAMP folder. Open MAMP here and click Start Servers
Now open MAMP PRO and the servers should be started
This is just a work-around, it definitely should not require these. At the very least, this should get you up and running.
Contacting support!
File -> Reset to Factory Settings
Possibly a permissions issue, but I wasn't able to resolve it. The above fixed it for me.
uninstall mamp.
remove all files about mamp.
reinstall mamp.
I removed 'my.cnf' from '/etc' directory. Restarted MAMP pro. Started server successfully.....
Your configuration may be wrong.
exp.
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION # success
or
sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' # error

Should I reinstall Mysql?

I'm getting kind of desperate here trying to get mysql to work on osx lion.
I've been through nearly every article on the web these past few days looking for a way to fix the problem with the error.
When I try to start the server is gives this error:
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
when I try to create a database with 'rake db:create' it gives the same error.
sometimes it says that or I get errors about "please install gem-blabhalbhabhlb". And that gem doesn't exist.
I was able to install mysql in terminal using the dmg version from mysql's site but after I deleted the installation files it just stopped working- as in when I run
rake cd:create
I get the mysql.sock error.
I'm going insane.. please help
For me I often need to force mysql to not use unix sockets, but regular php sockets.
To do this, connect to 127.0.0.1 instead of localhost. Works 90% of the time, all the time.
Major credit to John P. for helping me get this working last night
The first thing was to uninstall mysql using 'brew uninstall mysql'.
Then to install mysql from their development site. The community .dmg 64 bits version.
Then to find out where the path was pointing.
So in updating the paths he had to find where bin/mysql was and make sure bash_profile had it's path there.
PATH=$PATH:/usr/local/mysql/bin
The essential step after that was to 'source' the file so he had me run this command.
source ~/.bash_profile
From there mysql works flawlessly.