mysql yosemite
MySQL
MySQL is again a missing component in OS X 10.10 and needs to be dowloaded from the MySQL site use the Mac OS X ver. 10.9 (x86, 64-bit), DMG Archive version (works on 10.10). The latest version available is MySQL 5.6.21. Their is an issue with this version and Yosemite in that it won’t start on reboot – it will need to be started via command line explained below.If you are upgrading from a previous OSX and have an older MySQL version you do not have to update it, it will work just with the same start up issue. One thing with MySQL upgrades always take a data dump of your database in case things go south and before you upgrade to Yosemite make sure your MySQL Server is not running.
When downloading you don’t have to sign up, look for » No thanks, just take me to the downloads! – go straight to the download mirrors and download the software from a mirror which is closest to you.
Once downloaded open the .dmg and run the installer.
You will get a fail on the install but the software is still installed and useable, the reason is because the MySQL Start on Restart script fails.
If you do a custom install simply unclick that start up item. When you restart your machine just remember to start MySQL either via System Prefs or command line
Starting MySQL
You can then start the MySQL server from the System Preferences or via the command line or if restarted it has to be command lineCommand line start MySQL.
sudo /usr/local/mysql/support-files/mysql.server startTo find the MySQL version from the terminal, type at the prompt:
/usr/local/mysql/bin/mysql -vThis also puts you in to a shell interactive dialogue with mySQL, type q to exit.
After installation, in order to use mysql commands without typing the full path to the commands you need to add the mysql directory to your shell path, (optional step) this is done in your “.bash_profile” file in your home directory, if you don’t have that file just create it using vi or nano:
cd ; nano .bash_profile
export PATH="/usr/local/mysql/bin:$PATH"The first command brings you to your home directory and opens the .bash_profile file or creates a new one if it doesn’t exist, then add in the line above which adds the mysql binary path to commands that you can run. Exit the file with type “control + x” and when prompted save the change by typing “y”. Last thing to do here is to reload the shell for the above to work straight away.
source ~/.bash_profile
mysql -vYou will get the version number again, just type “q” to exit.
Set the MySQL root password
Note that this is not the same as the root or admin password of OSX – this is a unique password for the mysql root user, use one and remember/jot down somewhere what it is./usr/local/mysql/bin/mysqladmin -u root password 'yourpasswordhere'Use the single ‘quotes’ surrounding the password
Fix the 2002 MySQL Socket error
Fix the looming 2002 socket error – which is linking where MySQL places the socket and where OSX thinks it should be, MySQL puts it in /tmp and OSX looks for it in /var/mysql the socket is a type of file that allows mysql client/server communication.sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
AutoStarting MySQL on Reboot
There was a solution recently posted on how to autostart MySQL on reboot on Yosemite, if you follow this it will work:
sudo nano /Library/LaunchDaemons/com.mysql.mysql.plistAnd paste in:
Save it and then:KeepAlive Label com.mysql.mysqld ProgramArguments /usr/local/mysql/bin/mysqld_safe --user=mysql
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.plistThen it will load on a restart.