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.


sudo /usr/local/mysql/support-files/mysql.server start
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.
osx-yosemite-mysql-fail
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
osx-yosemite-mysql-uncheck-start-up-item

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 line
osx-yosemite-mysql

Command line start MySQL.
sudo /usr/local/mysql/support-files/mysql.server start
To find the MySQL version from the terminal, type at the prompt:
/usr/local/mysql/bin/mysql -v
This 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 -v
You 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.plist
And paste in:


  
    KeepAlive
    
    Label
    com.mysql.mysqld
    ProgramArguments
    
      /usr/local/mysql/bin/mysqld_safe
      --user=mysql
            
  
Save it and then:
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
Then it will load on a restart.

이 블로그의 인기 게시물

둘 중 누군가 그녀를 죽였다, 범인 해설

[MAC OS X] mds_stores 100% CPU usage

tips more on unity ...