MySQL

Install

  1. Download the 64 bit .dmg file from here: http://dev.mysql.com/downloads/mysql/
  2. Run the installer
    • Note: Install path: /usr/local/mysql
  3. Add /usr/local/mysql/bin to the PATH variable in .bash_profile
    1. export PATH=/usr/local/mysql/bin:$PATH 
    2. Quit the terminal and open it again for the changes to take effect
  4. Install the preference pane and start mysql
  5. Run this script with sudo in the terminal to secure mysql: mysql_secure_installation
  6. Make sure the folder containing the libmysqlclient.18.dylib is in the DYLD_LIBRARY_PATH
    • Run this command:
      export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
    • Or for it to be permanent add that line to .bash_profile

MySQLdb Python Connector

Note: You must have Xcode installed for this to work

  1. Unarchive it:
    tar xvfz MySQL-python-1.2.3.tar.gz
  2. From within the directory run these commands:
    1. python setup.py build
      sudo python setup.py install
  3. An alternative way to install is to run this command:
    1. easy_install MySQL-python

Brew Install

Follow these commands in this order (substituting your username):

brew install mysql
 unset TMPDIR
mysql_install_db --verbose --user=`nsalisbury` --basedir="$(brew --prefix mysql)" --datadir=/Users/nsalisbury/.homebrew/var/mysql --tmpdir=/tmp
mysql.server start
cp /Users/nsalisbury/.homebrew/Cellar/mysql/5.5.25a/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
/Users/nsalisbury/.homebrew/Cellar/mysql/5.5.25a/bin/mysql_secure_installation

- Usage:

  1. mysql.server {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]

Import Data

mysql -u root -p [database_name] < [file.sql]

References

nates/mac/mysql/mysql.txt · Last modified: 2012/07/19 08:51 by nates
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0