homebrew.mxcl.mysql.plist launchctl load error - mysql

I brew installed mysql and want to launchd start mysql at login.
brew install mysql
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
The brew install was successful, but after the last command, it shows
Could not find domain for
How to resolve this issue?
System info: Mac OS X 10.10 Yosemite, brew installed mysql-5.6.21.
On my other machine (same OS, newer and less used), the above three commends were successful and mysql indeed automatically start after restarting the machine.

The user running the command must be logged in via the GUI. Then, the command will work over both SSH and with a local terminal on the machine.

I had this issue when I was trying to start postgresql after installing it via homebrew, although previously it had worked fine. I later realised that it only failed when run remotely via SSH - when I used a local terminal it began without problems.

Re DanielaWaranie: sudo should not be necessary.
Remove the original plist and create the link again:
$ rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
$ brew services start mysql
I had the same issue. For some reason the ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist file was not a symbolic link but a regular file. After removing the file and creating the link again it worked fine.

This error message is missleading. Most common reason for this issue is a permission problem.
Just run it as root:
sudo su
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
I had the same issue on Mac OS X El Capitan when running with a restricted user using a interactive, non-login shell or an interactive, login shell. Works in a sh and bash.

Related

MySQL 5.7 stopped working on mac El Capitan

I upgraded the mysql from 5.5 to 5.7. I was working very well.
Today when I turned on my mac the mysql was not working and I can't start.
I tried to start by LaunchDaemon on system preferences but nothing happens and I tried by this command on terminal:
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
When I run this command I receive this message:
/Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist: service already loaded
but not work...
edit: I have no Idea why, but I restarted my mac and now it's working
first unload
sudo launchctl unload /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
(replaced from onload )
then
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
I do not know why, but my system automatically renamed the MySQL directory.
I identified that the usr/local/mysql/ directory was now called usr/local/mysql-5.7.21-macos10.13-x86_64/
What I did that solved the problem, was to create a symbolic link
{sudo ln -s mysql-5.7.21-macos10.13-x86_64 mysql}
I rebooted my mac, and everything worked correctly.
you will probably need to identify the new directory name with the command
{ls usr/local}

MySQL does not start when upgrading OSX to Yosemite or El Capitan

I know similar questions exist, such as MySQL with MAMP does not work with OSX Yosemite 10.10. However, I do have MAMP, nor XAMPP installed on my computer.
When I try to start mySQL from the PrefPane, nothing happens.
When I try to start mqSQL from the command line via sudo /usr/local/mysql/support-files/mysql.server start I get:
Starting MySQL . ERROR! The server quit without updating PID file
(/usr/local/mysql/data/adamg.local.pid).
Any and all help would be appreciated. I can supply any file output necessary.
Open a terminal:
Check MySQL system pref panel, if it says something along the line "Warning, /usr/local/mysql/data is not owned by 'mysql' or '_mysql'
If yes, go to the mysql folder cd /usr/local/mysql
do a sudo chown -R _mysql data/
This will change ownership of the /usr/local/mysql/data and all of its content to own by user '_mysql'
Check MySQL system pref panel, it should be saying it's running now, auto-magically. If not start again.
Another way to confirm is to do a
netstat -na | grep 3306
It should say:
tcp46 0 0 *.3306 *.* LISTEN
To see the process owner and process id of the mysqld:
ps aux | grep mysql
Long story short you need to create a launch file. So, from Terminal:
sudo vi /Library/LaunchDaemons/com.mysql.mysql.plist
(If you are not familiar with vi, then press i to start inserting text)
This should be the content of your file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true />
<key>Label</key>
<string>com.mysql.mysqld</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/mysql/bin/mysqld_safe</string>
<string>--user=mysql</string>
</array>
</dict>
</plist>
press esc then : wq!enter
Then you need to give the file the right permissions and set it to load on startup.
sudo chown root:wheel /Library/LaunchDaemons/com.mysql.mysql.plist
sudo chmod 644 /Library/LaunchDaemons/com.mysql.mysql.plist
sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql.plist
And that is it.
In my case I fixed it doing a little permission change:
sudo chown -R _mysql:_mysql /usr/local/var/mysql
sudo mysql.server start
I hope it helps somebody else...
Note: As per Mert Mertin comment:
For el capitan, it is sudo chown -R _mysql:_mysql /usr/local/var/mysql
Solved by installing the latest mySQL release, following the instructions here http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-10-yosemite/
EDIT
As Yosemite gets more popular, more people are stumbling on this question. The answer above has to do with upgrading MySQL, so that it runs. The answer linked by #doc in the comments has to do with getting MySQL to start automatically. These are 2 separate issues.
Execute the following commands from command line...
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
and then start the mysql server using
sudo /usr/local/mysql/support-files/mysql.server start
The .pid is the processid of the running mysql server instance. It appears in the data folder when mysql is running and removes itself when mysql is shutdown.
If the OSX operating system is upgraded and mysql is not shutdown properly before the upgrade,mysql quits when it started up it just quits because of the .pid file.
There are a few tricks you can try, http://coolestguidesontheplanet.com/mysql-error-server-quit-without-updating-pid-file/ failing these a reinstall is needed.
You just need to create the user mysql (mysql installation script creates _mysql)
sudo vipw
duplicate line that contains _mysql
Change for the duplicated line _mysql to mysql
sudo /usr/local/mysql/support-files/mysql.server start
Starting MySQL
.. SUCCESS!
The re-install fixed it because the installer created a new MySQL instance and the symbolic link to /usr/local/mysql now points to a data directory that does not have an existing pid.
It's worth noting that the mysql prefpane and mysql.server script use the hostname for the pid, so changing the hostname may cause issues with the this.
While the prefpane is out of date, it's a nice GUI for someone to start/stop MySQL even if the auto-start function doesn't work.
I've taken a hybrid approach where I've adapted my MySQL install script to use Launchd to auto-start MySQL, but the plist actually calls the mysql.server script. This way the prefpane can still be used to start/stop MySQL on demand, and trying to do a simple MySQL restart won't be too confusing.
Here is script that just enables this Launchd behavior on Yosemite with MySQL already installed:
https://raw.githubusercontent.com/MacMiniVault/Mac-Scripts/master/mmvMySQL/YosemiteLaunchd.sh
Here is the script that handles the entire automated installation of MySQL:
https://raw.githubusercontent.com/MacMiniVault/Mac-Scripts/master/mmvMySQL/mmvmysql.sh
You will sometimes miss previous data if you try to install new version.. Please use the following in your terminal and I guarantee that mySql will start running in no time..
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
Remember, it will ask for your Machine password and not mysql password..
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.
Try this:
sudo mysqld_safe &
Way simplest: copy and paste this into Terminal (but be sure to read more first):
bash <(curl -Ls http://git.io/eUx7rg)
This will install and configure everything automagically. The script is provided by MacMiniVault and is available on Github. More information about the mySQL install script on http://www.macminivault.com/mysql-yosemite/.
you want fix it can edit file "/Applications/XAMPP/xamppfiles/xampp" with TextEdit.
Look for text "$XAMPP_ROOT/bin/mysql.server start > /dev/null &"
And add "unset DYLD_LIBRARY_PATH" on top of it. It should look like:
unset DYLD_LIBRARY_PATH
$XAMPP_ROOT/bin/mysql.server start > /dev/null &
hope can help you
None of the above worked.. but installing a new version of MySQL did the trick.
2 steps solved my problem:
1) Delete "/Library/LaunchDaemons/com.mysql.mysql.plist"
2) Restart Yosemite
I usually start mysql server by typing
$ mysql.server start
without sudo. But in error I type sudo before the command. Now I have to remove the error file to start the server.
$ sudo rm /usr/local/var/mysql/`hostname`.err
My Mac decided to restart itself randomly; causing a whole slew of errors. One of which, was mysql refusing to start up properly. I went through many SO questions/answers as well as other sites.
Ultimately what ended up resolving MY issue was this:
1) Creating the file (/usr/local/mysql/data/.local.pid
2) chmod 777 on that file
3) executing mysql.server start (mine was
located in/usr/local/bin/mysql.server)
Same happened to me! So I tried to startup again after I had terminated the running mysql application, and that worked!

Can't fully uninstall MYSQL with Homebrew with Mac 10.8.5 How to find/remove "/etc/my.cnf" from old install?

This is a sample from my terminal.
My-MacBook-Pro:~ My$ brew update
Already up-tåo-date.
My-MacBook-Pro:~ My$ brew uninstall mysql
Error: No such keg: /usr/local/Cellar/mysql
My-MacBook-Pro:~ My$ brew install mysql
Warning: Your Xcode (4.5.2) is outdated
Please install Xcode 4.6.3.
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/mysql-5.6.1
Already downloaded: /Library/Caches/Homebrew/mysql-5.6.13.mountain_lion.bottle.tar.gz
==> Pouring mysql-5.6.13.mountain_lion.bottle.tar.gz
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
To connect:
mysql -uroot
To have launchd start mysql at login:
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Then to load mysql now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Or, if you don't want/need launchctl, you can just run:
mysql.server start
==> Summary
🍺 /usr/local/Cellar/mysql/5.6.13: 9381 files, 354M
My-MacBook-Pro:~ My$
The caveat says there is a left over file from another install, but I can't seem to uninstall it. I am not very familiar with libraries (though i look forward to getting better at them), and I can't find where all these files live.
I tried searching for my.cnf, but the results were:
adodb-mysqli.inc.php
adodb-mysqli.inc.php
php_CORE3.xml
none of which appear to be the right thing.
This also might be relevant.
When I enter in my terminal:
nano ~/.bash_profile
I get this, which contradicts what I was led to believe I would see.
export PATH=/usr/local/mysql/bin:$PATH
export Parth=/usr/local/mysql/bin:$PATH
export PATH=/usr/local/bin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/$
Any ideas on how I can remove this rogue file?
Edit: Further attempts listed below. They all remain fruitless.
I tried searching for the file in my terminal by entering the following:
My-MacBook-Pro:~ My$ sudo /usr/libexec/locate.updatedb
My-MacBook-Pro:~ My$ locate my.cnf
My-MacBook-Pro:~ My$ sudo find /etc -name *.cnf
No results.
I tried following the top two answers here: brew install mysql on mac os
but the file is still present. Both these (mentioned in the top answer) resulted in "no such file or directory"
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
I have also read that homebrew does not install a my.cmf file. This is all very confusing.
So i checked this brew definition for mysql and it appears that this message is always displayed; no matter what.
So I guess you can ignore it if you are sure there is no my.cnf around.

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.

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