can't start MySql in Mac OS 10.6 Snow Leopard - mysql

I've googled this and could'nt find anything new and useful for Apple's new OS SnowLeopard.
I wonder if this is my mistake or I do need to do something?
this is what I did:
Downloaded from mysql site:
http://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg
I choose : Mac OS X 10.5 (x86_64)
I run all the packages and installed all of them.
So now I certainly have mysql in
/usr/local/mysql/
But when trying to start it from preferences panel, it is always STOPPED.
When I try to do (in the terminal):
/usr/local/mysql/bin/mysql
I got :
-bash: /usr/local/mysql/bin/mysql: Bad CPU type in executable
What is wrong here?
Any help would be very appreciated. Thanks

Maybe this answer helps:
mysql5.58 unstart server in mac os 10.6.5
I just installed MySQL 5.5.8 (mysql-5.5.8-osx10.6-x86_64.dmg) on Mac os X 10.6.5 and also had the problem that MySQL was not starting.
After reading this post: http://forums.mysql.com/read.php?11,399397,399606#msg-399606
and editing the file as suggested everything started working.
I also did
sudo chown -R root:wheel /Library/StartupItems/MySQLCOM
after reading
https://discussions.apple.com/message/12820394
since when restarting my Mac OSx 10.6.6 it kept on asking something about not enough privileges. The line above solved that issue.
Now everything is working.

YOU MUST REINSTALL mySQL after upgrading to Snow Leopard and remove any previous versions as well as previous startup from the preference panel.
install 86_64 10.5...I find the others did not work for me.
Download MySQL version Mac OS X 10.5 (x86_64) located at
http://dev.mysql.com/downloads/mysql/5.4.html#macosx-dmg
Install startup Item (follow instructions)
Then install the beta version (follow instructions)
If you want the start up in the Preference Panel...install mySQL.prefpane
I find that SQL does not run from the terminal unless you start mySQL
in the preference panel.

Okay... Finally I could install it!
Why? or what I did?
well I am not sure.
first I downloaded and installed the package (I installed all the files(3) from the disk image)
but I couldn't start it. (nor from the preferences panel, nor from the termial)
second I removed it and installed through mac ports.
again, the same thing. could not start it.
Now I deleted it again, installed from the package. (i am not sure if it was the exact same package but I think it is)
Only this time I got the package from another site(its a mirror).
the site:
http://www.mmisoftware.co.uk/weblog/2009/08/29/mac-os-x-10-6-snow-leopard-and-mysql/
and the link:
http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.1/mysql-5.1.37-osx10.5-x86.dmg
1.- install mysql-5-1.37-osx10.5-x86.pkg
2.- install MySQLStartupItem.pkg
3.- install MySQL.prefpanel
And this time is working fine (even the preferences panel!)
Nothing special, I don't know what happened the first two times.
But thank you all.
Regards.

In order just to get MySQL working again (I haven't yet looked at startup), there is no need to reinstall . I've got my copy working by doing the following:
What you need to do is this:
sudo ln -s /usr/local/mysql-5.0.51a-osx10.5-x86_64 /usr/local/mysql
This creates a symbolic link from the /usr/local/mysql directory to the location where MySQL is. This is critical, because unless you carefully backed up all your databases with mysqldump before running the Leopard upgrade, that's where all your data lives - and restoring it simply from a whole-hard-drive backup is going to be hard.
Now you can go to the right directory and start up mysql:
cd /usr/local/mysql-5.0.51a-osx10.5-x86_64
sudo ./bin/mysqld_safe
You can now do the usual CTRL-Z to get back to the shell. To make sure mysqld is running, type:
sudo ps -A|grep mysql
I got something like this:
1220 ttys000 0:00.02 /bin/sh ./bin/mysqld_safe
1240 ttys000 0:00.39 /usr/local/mysql-5.0.51a-osx10.5-x86_64/bin/mysqld --basedir=/usr/local/mysql-5.0.51a-osx10.5-x86_64 --datadir=/usr/local/mysql-5.0.51a-osx10.5-x86_64/data --user=mysql --pid-file=/usr/local/mysql-5.0.51a-osx10.5-x86_64/data/dkmac-2.home.pid --port=3306 --socket=/tmp/mysql.soc
My copy of mysql now seems to work fine. At the very least, it's good enough to run mysqldump on all my databases, so that if I need to upgrade mysql by other means and dump my data directory, I'm still in good shape.

I'd guess that your iMac isn't 64-bit (you state in another thread it is an original white intel iMac). Try the 32-bit version of MySQL–it should install directly over the 64-bit version, I think.
How to tell if your Intel-based Mac has a 32-bit or 64-bit processor
http://support.apple.com/kb/HT3696

First of all can I just say that I really really love the Internet community for all that it does in providing answers to everybody. I don't post a lot but everybody's posting here and on so many boards helped me so much! None of them gave me the right answer mind you, but here is my unique solution to this nightmare of a spending 2 solid days trying to install MySQL 5.5.9 on Snow Leopard 10.6. Skip to bottom for resolution.
Here's what happened.
I had a server crash recently. The server was rebuilt and of course MySQL 5.5.8 didn't work. What a worthless piece. I had 5.1.54 on my other machine. That had been a pain to install as well but not like this.
I had all sorts of issues installing with the dmg from mysql.org, installing mysql5 using macports, uninstalling trying to revert to 5.1.54 (couldn't because I couldn't find the receipt file with that info even though I followed the directions). After rming everything I could find related to mysql and then reinstalling 5.5.8 everything worked! Until I rebooted... ☹ I looked in my system preference mysql pane and found mysql server wasn't starting. (skip to end for resolution)
My first error (super common) included:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock'
and numerous other EXTREMELY common issues related to mysql.sock
http://forums.mysql.com/read.php?11,9689,13272
Here were things I tried:
1)Create /etc/my.cnf file with the proper paths to mysql.sock. I even tried modifying mysql.server with vi directly. Modifying the php.ini was worthless. Nothing worked because MySQL wasn't starting, therefore it wasn't creating mysql.sock in the first place. Maybe you can point to the directory it is being created, and not the actual full file path i.e. not /tmp/mysql.sock but /tmp It was suggested but wasn't working because there was no mysql.sock because mysqld wasn't spawning.
2)Basedir and datadir modifications didn't work because there was no mysql.sock to point too.
Why? Because the mysql daemon wasn't starting. Without anything to start mysqld and thereby create mysql.sock I was doomed. They are an important part of the solution but if you try them and still get errors, you will know why.
3)sudo chown -R root:wheel /Library/StartupItems/MySQLCOM/
didn't solve my problem. I ended up having that folder and all items set to root:wheel though in the end, because it was one of the many things recommended and its working. Maybe it could remain _mysql but wheel works.
4)Copy mysql.sock from another machine. Doesn't work. I had searched and searched my new machine and couldn't find mysql.sock. I was using find / | grep mysql.sock because locate mysql wasn't finding anything. Besides I was trying so many different things it wasn't updating enough to find my new installs. I now like find much more than locate, even though you can update the locate db.
Anyhow you can't copy mysql.sock, even if you tar it because its a 0 byte file.
THE RESOLUTION: I finally stumbled onto the solution. I finally just typed mysqld from command line while I was in the proper bin directory. It said another process was running. _mysql was spawning a process that I could see in the Activity Monitor. I killed the active mysql process and when I typed mysqld again I found it was creating my mysql.sock file in the /private/tmp/mysql.sock
The mysql pref pane wouldn't start the right process on login, so I just disabled that for being worthless. It wouldn't start mysql because no mysql.sock was being created.
By then I had figured out that mysqld creates mysql.sock. I then found /opt/local/mysql/ and typed "open bin" in the terminal window. This opened the directory with mysqld in it.
I went to login items in the system preferences in my account settings and dragged and dropped the mysqld file onto the startup items there. THAT worked. Finally!
It works flawlessly because mysqld is starting up at login, which means mysql.sock is being created so no more errors about not being able to find mysql.sock.

open Terminal
cd /usr/local/mysql/support-files
sudo nano mysql.server
Find the lines:
basedir=
datadir=
change them to
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data

Have you considered installing MacPorts 1.8.0 (release candidate), and keeping MySQL up-to-date that way? That will build MySQL for the architecture and OS that you're using, rather than installing a 10.5 version on 10.6.

Along with making sure you install the 64bit version, also check to make sure that the symbolic link of '/usr/local/mysql' is pointing to the correct version of your installation:
lrwxr-xr-x 1 root wheel 27B Aug 29 01:24 mysql -> mysql-5.1.37-osx10.5-x86_64
drwxr-xr-x 3 root wheel 102B Aug 29 01:25 mysql-5.1.30-osx10.5-x86
drwxr-xr-x 11 root wheel 374B Aug 29 15:59 mysql-5.1.37-osx10.5-x86_64
drwxr-xr-x 17 root wheel 578B Jul 13 22:06 mysql-5.1.37-osx10.5-x86_64.old
Alos, I found that after my installation, even though I used the pkg file from MySQL various other libraries would not build against the installation. The solution was to follow the steps to build MySQL from source found here. You can manually start it as root with the command:
/usr/loca/mysql/bin/mysqld_safe [whatever options you use]
Now ... to get the preference pane working I did the following:
Installed 64bit version of MySQL Server packet from mysql.com
Moved the package from mysql-5.1.37-osx10.5-x86_64 to mysql-5.1.37-osx10.5-x86_64.old
Did a manual compile and installation of MySQL as per these instructions
Executed the following command:
sudo cp -R /usr/local/mysql-5.1.37-osx10.5-x86_64.old/support-files /usr/local/mysql/.
Opened up the MySQL Preference Pane and tada! it works

I followed the exact same steps as answer #4....frustrating I know, but it finally worked when I installed the beta version and removed everything completely.
Removal help:
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/com.mysql*
Then edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
Also go to: /Library/Receipts and look for a file named “InstallHistory.plist”. It’s just a regular property list. Open it and look for the MySQL entry, and delete it.

snow leopard is different to the "old" leopard therefore its not surprising that the sources won' work...
you should probably wait till the official release on friday and oracle might be releasing a properly working sql version soon.

Easiest Solution I've found:
After installing the MySQL package for Mac OS X Snow Leopard (check whether you have a 32bit or 64bit processor). Can always default to the 32bit version to be safe.
Simply click to install the MySQL preferences inside the dmg and when prompted whether to allow access for just you or for the entire system, choose entire system.
This worked great for me.

See this - recreating the symlink may be all you need to do: http://planet-geek.com/archives/2009/09/osx-snow-leopar.html

my apple processor version10.6.3 is error and i can click system preference

Change the following to the file
/usr/local/mysql/support-files/mysql.server the follow lines:
basedir="/usr/local/mysql"
datadir="/usr/local/mysql/data"
and save it.
In the file /etc/rc.common add the follow line at end:
/usr/local/mysql/bin/mysqld_safe --user=mysql &

I'm not entirely sure why my MySQL installation stopped working but it started trying to run as the incorrect user, as mysql instead of _mysql
Here was my error output:
140422 14:46:14 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
140422 14:46:14 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
140422 14:46:14 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists!
140422 14:46:14 [ERROR] Aborting
140422 14:46:14 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
The fix for me was to edit /usr/local/mysql/bin/mysqld_safe and set the user line at the top from:
user='mysql'
to
user='_mysql'
That line was on line 25 for me with mysql-5.5.37-osx10.6-x86_64

To completely uninstall on Apple Silicon (M1 or M2
) chip run bellow commands:
brew remove mysql
rm -rf /opt/homebrew/var/mysql
To install it back:
brew install mysql
mysql.server start
mysql -uroot
And can also be run using brew services
brew services start mysql

Related

How to install and start MySQL 5.7 on macOS BigSur (Apple Silicon) with Homebrew?

I need a specific version of MySQL (5.7) to be installed on my MacBook with M1.
I'm trying to do that with Homebrew.
brew install mysql#5.7
The output:
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -uroot
mysql#5.7 is keg-only, which means it was not symlinked into /opt/homebrew, because this is an alternate version of another formula.
If you need to have mysql#5.7 first in your PATH, run: echo 'export PATH="/opt/homebrew/opt/mysql#5.7/bin:$PATH"' >> ~/.zshrc
For compilers to find mysql#5.7 you may need to set: export LDFLAGS="-L/opt/homebrew/opt/mysql#5.7/lib" export CPPFLAGS="-I/opt/homebrew/opt/mysql#5.7/include"
To have launchd start mysql#5.7 now and restart at login: brew services start mysql#5.7 Or, if you don't want/need a background service you can just run: /opt/homebrew/opt/mysql#5.7/bin/mysql.server start
Right after that, I try to run:
echo 'export PATH="/opt/homebrew/opt/mysql#5.7/bin:$PATH"' >> ~/.zshrc
source .zshrc
mysql_secure_installation
And get the error:
Securing the MySQL server deployment.
Enter password for user root:
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Also, I've tried:
brew services start mysql#5.7
And also get the error:
Error: Permission denied # rb_sysopen - /Users/vivanc/Library/LaunchAgents/homebrew.mxcl.mysql#5.7.plist
Seems like there is a permissions-related problem.
Any advice is appreciated.
If you are running into issues like "Can't connect to local MySQL server through socket '/tmp/mysql.sock'" or "The post-install step did not complete successfully MySQL", and you installed a previous version of mysql (e.g. 8.x) previously, you may have been at the point where you need to clean everything before reinstalling your preferred version of mysql#x.x.
If you've already visited these to links:
Uninstall all those broken versions of MySQL and re-install it with Brew on Mac Mavericks (Coderwall) + Install MySQL 5.7 on macOS using Homebrew (github) and your're still having trouble with starting your mysql-service, you should try to also remove also /opt/homebrew/etc/my.cnf file.
Remove it together with all the related files too! Summary for an M1 Apple Silcion machine, after uninstalling via brew uninstall mysql or brew uninstall mysql#x.x, please remove:
/opt/homebrew/var/mysql
/opt/homebrew/etc/my.cnf
After this, everything worked like a fresh install (for me). Hope this saved someone's time.
While this question is specific to Apple Silicon and mysql 5.7, and I will address that in this answer, I would like to start by adding some general notes to save others time:
Homebrew supports mysql 5.7 for both intel and apple silicon.
https://formulae.brew.sh/formula/mysql#5.7
Homebrew supports mysql 5.6 for the intel chip, but not apple silicon:
https://formulae.brew.sh/formula/mysql#5.6
If you need 5.6 on apple silicon, it's probably a good idea to just settle with 5.7 since production will need to be upgraded eventually and the differences aren't that big.
In my situation I originally did brew install mysql and it gave me the latest mysql (currently 8.0). When I tried going back over it and doing brew install mysql#5.6, of course this didn't work due to not being supported on the m1 max (apple silicon). I ran into issues then trying to get brew install mysql#5.7 working. I followed some guides mentioning various suggestions. After playing with it for a while, it seems that running two versions of mysql at once will corrupt your mysql files and make it hard to work with and confuse homebrew.
I came across these guides:
brew install mysql on macOS
https://coderwall.com/p/os6woq/uninstall-all-those-broken-versions-of-mysql-and-re-install-it-with-brew-on-mac-mavericks
https://www.codegrepper.com/code-examples/shell/brew+uninstall+mysql
Before reading further, note that in my situation, I had a zip available for my whole local mysql database needs and could risk destroying what I have.
Warning! Reading further and executing these commands carelessly may delete your mysql storage. Make sure you have a backup.
brew remove mysql is a good command that got rid of my latest install.
I also needed brew remove mysql#5.7 even though this is the version I'm trying to install, but they were stepping on each other's foot...
brew cleanup is nice, I noticed it freed up some lock files.
I don't recall having any luck with:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
but you can try it.
rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist has worked for me.
But note there will also be another file in there for your 5.7 setup.
I'd recommend:
cd ~/Library/LaunchAgents/ then look around to see if you have any mysql* in there. Then if you do, such as homebrew.mxcl.mysql#5.7.plist, then remove it.
These are some that worked for me:
sudo rm -rf /usr/local/var/mysql
rm /usr/local/etc/my.cnf
rm /usr/local/etc/my.cnf.default
Also:
cd opt/homebrew/var
Then if you notice a mysql directory in there, remove it.
It's possible you might have docker or something else similar also running mysql or mysqld.
ps -ax | grep "[m]ysql"
(Note the brackets and quotes in the above is to prevent the grep from showing up in the process list and matching itself unlike the lazier version: ps -ax | grep mysql which will give the impression there's an extra mysql process running)
Once you're ready, please run:
brew services list
double-check you don't have mysql in there.
Then double check you don't have any mysql process running:
ps -ax | grep "[m]ysql"
This can happen for example if you enter mysqld for example....
You might need to do brew services stop mysql or brew services stop mysql#5.7 or similar and repeat steps if you see anything on the service list or process list.
Finally, you should be ready for a fresh install.
The fresh installation process should be rather straight forward:
brew install mysql#5.7
brew link --force mysql#5.7
brew services start mysql#5.7
Then run brew services list to make sure your installation worked correctly.
If you see it's green and "started", your installation was successful!
You should also run:
mysql_secure_installation
Then choose a password for root and go through the list of questions like validation, etc.
Once you're installed, you might also run into mysql mode issues.
cd /opt/homebrew/etc and you should find a my.cnf file.
Edit it using either vim or nano.
You should see something like:
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
Edit it and set the mysql mode. For example, I don't want the no_zero_in_date mode, so I use:
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
sql-mode="ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Then restart mysql like so:
brew services restart mysql#5.7
Then double check you still have a green status "started":
brew services list
If you do, then you should have the no_zero_in_date mode disabled.
You can test it with a query:
SELECT ##sql_mode;
You should now have mysql 5.7 running on Apple Silicon and have the sql_mode set.
If you run into more troubleshooting, do your best to get into a known state such as uninstalled, doing a fresh install, or already installed with some version, etc.
I solved it after hours of searching, it was because I had not cleaned everything regarding my previous MySQL 8.X installation. I followed this and got suspicious when I realized I don't have most of the folders there. I then did a search for all folders named mysql on my computer and found a mysql folder in opt/homebrew/var. After removing it, reinstalling MySQL 5.7, and starting the server everything is working as expected.
When setting up my Apple M1 Macbook Pro I was experiencing the issue of the following error message being thrown:
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
My fix was to modify the MySQL config file:
nano /usr/local/etc/my.cnf
Append the following lines:
tmpdir=/tmp
user=root
Then run:
brew services restart mysql#5.7
This fixed my issue, and I was then able to connect successfully with my DB client.
Seems like I found the solution (or workaround).
After installing the MySQL 5.7 with Homebrew just run:
mysql.server start
MySQL is started and then you are able to run mysql_secure_installation and mysql commands.
I got this warning:
You should change the ownership of these directories to your user.
sudo chown -R $(whoami) /usr/local/share/doc /usr/local/share/man /usr/local/share/man/man1
And make sure that your user has write permission.
chmod u+w /usr/local/share/doc /usr/local/share/man /usr/local/share/man/man1
I run those two command then it works.

Lost or corrupt mysql table after computer is turned off or restarted

I'm using a mysql local database to store some data from two ruby scripts i created. The problem is that whenever I restart or turn off my computer my database seems to get corrupted as when i tried to access it it show the following error:
Can't connect to MySQL server on 'Andres-MacBook-Air-3.local' (61) (Mysql2::Error)
I then use the following commands (which I found while googling around) to restore the connection:
cd /usr/local/mysql
sudo ./bin/mysqld_safe
(Enter your password, if necessary)
(Press Control-Z)
bg
After I do that, I can connect to the database but when I try to access a table the following error comes up:
Error retrieving table information
An error occurred while retrieving the information for table 'fourCheckins'. Please try again.
MySQL said: Table 'trackpuntos.fourcheckins' doesn't exist
I think that turning off/restarting my computer is causing the problem as this same scenario has happen to be twice. Fortunately after the first time I am doing regular mysqldumps.
Does anyone have an idea on why is this happening/how to prevent it?
I'm running mysql 5.6.12, on a macbook air running OS Lion.
Thanks
I've been having the same problem for the past week. I'm finding the InnoDB databases are getting corrupted when I have open connections to the databases and I shut off/restart the computer.
I had installed mysql 5.6 unintentionally via homebrew upgrade on my Mac. I just rolled mysql back to 5.5.29 following the instructions below. After the downgrade back to 5.5, I set up my databases again, opened a bunch of connections, and then shutdown the computer. Upon reboot, I had no corruptions. Hopefully it'll stay that way!
Note: paths may be different for your system
Uninstall 5.6 mysql via homebrew
$ brew uninstall mysql
$ rm -rf /usr/local/var/mysql
Install 5.5.29 mysql via homebrew
$ cd /usr/local/Library/Formula
$ git checkout -b mysql-5.5.29 336c97637c5449018cde59f7d2a87a298692da08
$ brew install mysql
follow all the post-install steps for mysql...
$ unset TMPDIR
$ mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
reset homebrew to master !important!
$ git checkout master
Lastly, don't brew upgrade mysql until 5.6 is more stable!
I had the same problem after a reboot... Just stopped and restarted MySQL and my DB was working fine after that.

MySQL Mac OS X Problems

something strange is happening while trying to run MySQL server on my MacBook Air.
First ill installed MySQL using brew install mysql. Installation was successful without any errors.
And then problems started to showing up...
First i had to use following command in order to create empty tables:
cd /usr/local
sudo mysql_install_db --user=mysql --ldata=/var/db/mysql
Now im trying to launch the server service itself, but another error is not allowing me to do it:
ivankutsarov$ sudo mysql.server start
Password:
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/Ivans-MacBook-Air.local.pid).
While ill navigate to the mentioned folder i cant see mysql folder in it, neither i can see it in my /usr/local/bin directory.
Any ideas guys?
Guys i found the problem. I forgot to run these 2 commands after installing mysql:
First, run: brew help mysql
Read the info displayed after command was executed, and you will notice in the first 2 lines the following commands which are necessary to run in order to start your server!
1.
unset TMPDIR
2.
mysql_install_db --verbose --user=whoami --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
I had a similar problem a day ago. mysql functioned fine until out of the blue PID file errors occur. I tried everything to fix the installation, replacing a dozen of files and trying many different settings.
what eventually worked was a clean install of mysql via the dmg package and a migration of my data&schema's to this install (use mysql workbench for this to save time), then uninstalled the version installed via brew.
https://dev.mysql.com/downloads/file/?id=466265

After MySQL install via Brew, I get the error - The server quit without updating PID file

Ok, I've searched all over and have spent quite a bit of my time installing, uninstalling, trying various option but without success.
I'm on Mac OS X Lion (10.7.3) and am trying to setup a Python, MySQL.
I successfully installed Python and MySQL via HomeBrew.
Python works great.
After MySQL Installation, I followed the first 2 steps - unset and the mysql_install_db commands.
Now, when I try to start mysql "mysql.server start", I get the following error
ERROR! The server quit without updating PID file (/usr/local/var/mysql/Brajeshwar.local.pid).
Brajeshwar is my username on my machine.
I found that it was a permissions issue with the mysql folder.
chmod -R 777 /usr/local/var/mysql/
solved it for me.
EDIT 2012/09/18:
As pointed out by Kane, make sure the mysql database is properly set up before doing anything else. See “PID error on mysql.server start?” for more info.
Original answer kept for history's sake:
It most likely is a permissions issue. Check /usr/local/var/mysql/*.err. Mine said:
120314 16:30:14 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
120314 16:30:14 mysqld_safe mysqld from pid file /usr/local/var/mysql/janmoesen.local.pid ended
I also had to do this:
sudo chown _mysql /usr/local/var/mysql/*
I ended up with completely reinstalling of mysql, and it finally worked out.
WARNING This will remove all of your databases, so make sure to save dumps first.
brew remove mysql
brew cleanup
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /usr/local/var/mysql
brew install mysql
mysqld --initialize --explicit_defaults_for_timestamp
mysql.server start # no sudo!
I had this issue on mac 10.10.5 Yosemite
What I did to solve this
cd /usr/local/var/mysql
sudo rm *.err && sudo rm *.pid
sudo reboot
sudo mysql.server start
I had the same issue on OS X El Capitan, here's the terminal command sequence that fixed it for me.
Delete error files (you'll have to change the path depending on your setup)
sudo rm /usr/local/mysql/data/*.err
Find the info for the mysql process that's still running and kill it:
ps -A | grep -m1 mysql | awk '{print $1}' | sudo xargs kill -9
Now restart MySQL:
/usr/local/mysql/support-files/mysql.server start
November, 2014: If you're getting this error on MySQL 5.6.x on Mac OS X Mavericks or Yosemite and want to use MySQL with PHP locally (/tmp/mysql.sock is where PHP PDO expects to find the sock file), here is what fixed it for me:
1) Uncomment the default homebrew config file lines and edit as below
$ sudo vi /usr/local/Cellar/mysql/5.6.21/my.cnf
...
basedir = /usr/local/Cellar/mysql/5.6.21
datadir = /usr/local/var/mysql
port = 3306
server_id = <UNIQUE_NUMBER_HERE_OR_LEAVE_COMMENTED_OUT>
socket = /tmp/mysql.sock
pid-file = /usr/local/var/mysql/[BOXNAME].local.pid
....
BOXNAME is what you have in your System Prefs -> Network as the unique id for your computer on the network.
2) Set permissions on all the files in the mysql datadir. These were all owned by [my_username]. MySQL is very picky about this and refuses to create the pid file unless it (the user _mysql) owns the directory.
$ sudo chown -R _mysql:mysql /usr/local/var/mysql
3) Start MySQL using the bash helper/wrapper script:
$ sudo mysql.server start
Starting MySQL
. SUCCESS!
Hope that helps. If the above doesn't work for you, try to run the mysqld_safe binary manually in the Cellar/mysql/VERSION_/bin/ directory and check what the settings are (if it runs)
sudo /usr/local/Cellar/mysql/5.6.12/bin/mysqld_safe &
If that runs, you can
ps aux | grep mysql
and see something like
[username] 6881 0.0 2.7 3081392 454836 ?? S 8:52AM 0:00.54 /usr/local/Cellar/mysql/5.6.21/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.6.21 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.6.21/lib/plugin --verbose --log-error=/usr/local/var/mysql/BOXNAME.local.err --pid-file=/usr/local/var/mysql/BOXNAME.local.pid
I'm not sure why that worked for me but it shows you where I got the my.cnf config file options from. You can also use the command line options to try to troubleshoot when starting mysqld manually.
If you do run manage to run MySQL server using mysqld_safe, you may have to do this to shut it down before trying the mysql.server bash helper. Resist the urge to kill -9 [PID] because you can corrupt your data.
mysqladmin -uroot shutdown
Good luck!
This worked for me:
sudo chmod -R 777 /usr/local/var/mysql/
sudo /usr/local/mysql/support-files/mysql.server start
This worked for me on 10.12.2 :
$ rm /usr/local/var/mysql/*.err
then
$ brew services restart mysql
If I remember correctly it is a permissions issue. Try to 'touch' and 'chmod' the pid file or the folder the file is held in.
My issue was that I started server as sudo once and then tried to restart as a local user.
Here mysql was not able to write to '.err' file owned by root.
I had to remove that file and restart the server:
sudo rm /usr/local/var/mysql/*.err
mysql.server start
Try this (OSX)
Step 1:
ps -aux | grep mysql
Then kill the 4 digits PID number
Step 2: kill 1965
Step 3: mysql.server start
Or having hard time to locate those PID numbers, try this below
Step 1 again: ps -aux | grep mysql
Step 2 again: killall
Step 3 again: mysql.server start
I’ve got a similar problem with MySQL on a Mac (Mac Os X Could not startup MySQL Server. Reason: 255 and also “ERROR! The server quit without updating PID file”). 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.
Find usr/local/var/mysql/your_computer_name.local.err file and understand the more information about error
Location : /usr/local/var/mysql/your_computer_name.local.err
It's probably problem with permissions
Find if mysql is running and kill it
ps -ef | grep mysql
kill -9 PID
where PID is second column value
2. check ownership of mysql
ls -laF /usr/local/var/mysql/
if it is owned by root, change it mysql or your user name

sudo chown -R mysql /usr/local/var/mysql/
For me it worked with:
unset TMPDIR
mysql_install_db --user=`whoami` --basedir="$(brew --prefix mariadb)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
What worked for me was:
Go to your mysql installation directory
sudo chmod -R 777 data
Then go back one directory
cd support-files/
sudo ./mysql.server start
After that the server started running.
But the problem with this method is that I have to repeat this every time I want to start the mysql now. Don't know why it started behaving like this suddenly.
I had this problem on Linux, but the cause is relevant to any mysql installation. In my case, the server was crashing before startup was complete and the pid file updated. The error messages were seen when starting up mysqld directly instead of via "service mysql start".
In my case, the cause was the partition where the log files were located being full. Removing log files permitted mysql to start again. To test for this issue, go to the location of your mysql activity logs, and do df ..
If you have upgraded your mysql installation to 8.x, check if your previous version is supported for upgradation.
If not, mysql will not work! Uninstall your mysql along with all configuration files in /usr/local/var/mysql (remove the whole folder). Reinstall mysql.
NOTE: reinstalling might lead to loss of data.
Please check the log , you will get more detailed information .
Use the below command to tail the error log
tail -100 /usr/local/var/mysql/<user_name>.local.err
For me , one of the directory is missing , once created the server has started .
The key takeaway is to check the .err file, by default on Mac OSX it's in /usr/local/var/mysql.
That log filed revealed to me that I had to delete the following files:
ibdata1
ib_logfile0
ib_logfile1
Running MySQL with mysql.start worked successfully after that. Note that deleting those files will likely causes data loss.
sudo chmod -R 777 /usr/local/var/mysql/
works for me.
I had the same issue:
But the situation was, every time i try to enter:
/usr/local/mysql/support-files/mysql.server start
a file named localhost.pid is created instead of iMax0.local.pid which was stated in the error:
ERROR! The server quit without updating PID file (/usr/local/mysql/data/iMax0.local.pid).
Solution that works for me was copying localhost.pid and renaming it to iMax0.local.pid.
My solution on OSX El Capitan was:
sudo chmod ugo+w /tmp
It was broken suddenly.
The error was:
ERROR! The server quit without updating PID file
and the log showed:
Can't start server : Bind on unix socket: Permission denied
It might also be helpful to note, that under OSX there is no my.cnf file by default and not needed by default, which I did not know. Good luck!
$ sudo mysql.server restart
It works for me.
I had the similar issue. But the following commands saved me.
cd /usr/local/Cellar
sudo chown _mysql mysql
This is file permission problem.
Check disk permissions and repair.
Osx => Cmd+Space => Disk Utilty => Verify Disk Permissions.
Verify completed after Repair Disk Permissions.
mysql.server start command is worked succesfuly.
None of the answers worked for me. However, I simply did sudo mysql.server start and it worked nicely.
Also, for me, it did NOT show permissions issue in *.err file.
all solutions above doesn't work for me.
but they give me some clues to fix this error.
mysql.server start ----error The server quit without updating PID file
I installed mysql#5.7 on my macbook mojave with homebrew
brew install mysql#5.7
mysql error log located in /usr/local/var/mysql/IU.lan.err,there is one line in it:
Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
after trying many posts in goole search engine,I turned to baidu
https://blog.csdn.net/xhool/article/details/52398042
inspired by this post,I found the solution:
rm /usr/local/var/mysql/*
mysqld --initialize
a random password for root user will be shown in bash.
but the command mysql -uroot -p[theRandomPassword] cant work.so I have to reset password.
create a init file with contents like this
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('MyNewPass');
place it in any directory easy to find,such as Desktop
mysqld --init-file=[YourInitFile] &
many logs printed on your screen.
mysql -uroot -pMyNewPass
enjoy your high-version mysql!
Happened to me because I was actually switching from MariaDB to Mysql.
Switching back to MariaDB solved this.
I'm guessing the existing database wasn't compatible.
Solved this using sudo chown -R _mysql:_mysql /usr/local/var/mysql
Thanks to Matteo Alessani
This error may be actually being show because mysql is already started. Try to see the current status by:
mysql.server status

Getting MySQL working on OSX 10.7 Lion

I'm currently trying to get MySQL working on OSX 10.7 Lion. I tried the brew way:
brew install mysql
-> cmake -> no problems
-> make -> no problems
-> make install -> no problems
-> done
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
Installing MySQL system tables...
/usr/local/bin/mysql_install_db: line 428: 15397 Done { echo "use mysql;"; cat $create_system_tables $fill_system_tables; }
15398 Done(141) | eval "$filter_cmd_line"
15401 Segmentation fault: 11 | $mysqld_install_cmd_line > /dev/null
Installation of system tables failed! Examine the logs in
/usr/local/var/mysql for more information.
Did anyone get mysql to run on Lion?
You can download a MySQL installer as a DMG file, complete with an installer, system preferences pane and a startup script directly from MySQL. Go to MySQL's community server download page, select Mac OS X as the platform and pick the DMG file.
You can skip the registration form (there a little link under the signup form) and you should be on your way.
Once the file is downloaded, double-click on the DMG, launch the installer and complete the installation. After that, install the startup script using its installer and finally the preferences pane by double-clicking on it. I highly recommend choosing to install it for all users on the computer.
You'll find this way much easier than compiling from source.
You should check out Sequel Pro if you need a great OS X tool to manage your MySQL databases.
A drop in replacement for mysql is mariadb. You can install with 'brew install mariadb'. It builds on Lion.
Existing mysql drivers and clients just work. I'm using it with python-mysql and django.
It's even called mysql so you won't even know the difference.
Ha! Got it!
First... download mysql-5.6.2 here: http://dev.mysql.com/downloads/mirror.php?id=402349#mirrors ... once finished, untar the file and do this:
mv path/to/mysql-5.6.2-m5-osx10.6-x86_64 /usr/local/mysql
echo "PATH=\$PATH:/usr/local/mysql/bin" >> ~/.profile
# open a new tab
cd /usr/local/mysql #this is essential!
./scripts/mysql_install_db
mysqld_safe &
mysql -uroot
works for me :)
You need to set up your path environment too, and it's also good practise to set a root password while you're at it. I've created a full step-by-step here: How to install MySQL on Lion (Mac OS X )
All,
I was having issues with connecting to my DB through Tomcat, yet could through the MySql tool. Tomcat was accessing it through the actual IP of my machine (10.0.x.x) instead of through localhost or 127.0.0.1. Turns out that when I migrated from SL to Lion, remote connections were disabled. Once I enabled them, it worked fine.
Hopefully this helps someone.
I had MySQL installed already, but after upgrading to Lion it would no longer start.
I tried installing the latest official version and it still wouldn't start.
Finally, this fixed it:
$ sudo mkdir /var/log/mysql
$ sudo chown mysql:mysql /var/log/mysql