Autostart MySQL Server on start-up – Mac OS X 10.10 Yosemite

After installing Yosemite, MySQL Server will no longer autostart on start-up.  If you are facing this problem of manually starting up MySQL Server every time you restart Mac OS X Yosemite, here is the solution.

Autostart MySQL Server on startup – Mac OS X Yosemite

USING TERMINAL & VIM:
1. Open Terminal
2. Create a new file “com.mysql.mysql.plist” at /Library/LauchDaemons/
cd /Library/LauchDaemons/
sudo vi com.mysql.mysql.plist
3. Copy and paste the following contents in the file. Using “vi” you need to press “i” to starting inserting and CMD+v to paste the contents.

<?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>

4. Save the file. Using “vi” you need to press “esc” and then type “:wq” & press “enter” to save the file.
5. Change the permissions of the file using the following commands.
sudo chown root /Library/LaunchDaemons/com.mysql.mysql.plist
sudo chgrp wheel /Library/LaunchDaemons/com.mysql.mysql.plist
sudo chmod 644 /Library/LaunchDaemons/com.mysql.mysql.plist

6. Run the Launch script using the following commands
sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql.plist

USING TEXTEDIT:
1. Open textedit app.
2. Click “New Document” on the left bottom or type Cmd + n
3. Enter the following contents

<?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>

4. File -> Save… as “com.mysql.mysql.plist” on desktop.
5. Open “Macintosh HD” folder and select Library -> LaunchDaemons folders
6. Drag the “com.mysql.mysql.plist” to this LauchDaemons folder.
7. Authenticate to move it.
8. Open Terminal and type the copy and paste the following commands
sudo chown root /Library/LaunchDaemons/com.mysql.mysql.plist
sudo chgrp 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

Restart Yosemite to see your MySQL server auto-start on restart. You can check MySQL status in System Preferences if you have installed MySQLStartItem.pkg and MySQL.prefPane from the MySQL dmg. Read more about it at http://dev.mysql.com/doc/refman/5.1/en/macosx-installation-startupitem.html

Enjoy! and let me know in the comments if you have any problem.

Clear or Remove “Top Hits” from Safari – Mac OS X

Recently, faced a problem when I wanted to remove a specific url from the “top hits” of my Safari 7 address bar in Mac OS X but found that it is nearly impossible to do so from Safari. There is no direct solution for this problem as even deleting it from history won’t remove it from the “Top hits”. After going through some files and some testing found the solution. Follow the below steps to remove any specific top hits from your Safari address/search bar.

1. Quit Safari
2. Go to ~/Library/Safari/ in finder. (Library folder in current user home)
3. Find “History.plist” file and edit it using textedit or text wrangler. (you may want to backup this file in case you messed it up)
4. Search in the file for the URL (for e.g. yoursearch.com) or the text (for e.g. yoursearch) that you are wanted delete from your “top hits”.
5. Identify the parent “ …. http://yoursearch ….. ” and delete it from the file.
6. Find any other instances of the same and delete the entire “” tags.
6. Open Safari and Enjoy. “yoursearch.com” will no longer be there.

Hope this will help a few facing this problem as Safari doesn’t give any way of removing individual “Top hits” URLs.