Skip to content

Instantly share code, notes, and snippets.

@jfsiii
Created March 30, 2012 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfsiii/2246080 to your computer and use it in GitHub Desktop.
Save jfsiii/2246080 to your computer and use it in GitHub Desktop.
brew install mysql
~ → brew install mysql
==> Installing mysql dependency: readline
==> Downloading http://ftpmirror.gnu.org/readline/readline-6.2.tar.gz
Already downloaded: /Users/jfsiii/Library/Caches/Homebrew/readline-6.2.2.tar.gz
==> Downloading patches
######################################################################## 100.0%
######################################################################## 100.0%
==> Patching
patching file vi_mode.c
patching file callback.c
patching file support/shobj-conf
patching file patchlevel
==> ./configure --prefix=/usr/local/Cellar/readline/6.2.2 --mandir=/usr/local/Cellar/readline/6.2.2/share/man --infodir=/usr/local/Cellar/readline/6.2.2/share/info --enable-multib
==> make install
==> Caveats
This formula is keg-only, so it was not symlinked into /usr/local.
OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
Generally there are no consequences of this for you.
If you build your own software and it requires this formula, you'll need
to add its lib & include paths to your build variables:
LDFLAGS -L/usr/local/Cellar/readline/6.2.2/lib
CPPFLAGS -I/usr/local/Cellar/readline/6.2.2/include
==> Summary
/usr/local/Cellar/readline/6.2.2: 30 files, 1.5M, built in 17 seconds
==> Installing mysql dependency: pidof
==> Downloading http://www.nightproductions.net/downloads/pidof_source.tar.gz
######################################################################## 100.0%
==> make all
==> /usr/bin/gzip pidof.1
/usr/local/Cellar/pidof/0.1.4: 3 files, 24K, built in 2 seconds
==> Installing mysql
==> Downloading http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.20.tar.gz
######################################################################## 100.0%
==> Patching
patching file scripts/mysql_config.sh
==> cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/mysql/5.5.20 -DMYSQL_DATADIR=/usr/local/var/mysql -DINSTALL_MANDIR=/usr/local/Cellar/mysql/5.5.20/share/man -DINSTALL_DOCDIR=/
==> make
==> make install
==> Caveats
Set up databases to run AS YOUR USER ACCOUNT with:
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
To set up base tables in another folder, or use a different user to run
mysqld, view the help for mysqld_install_db:
mysql_install_db --help
and view the MySQL documentation:
* http://dev.mysql.com/doc/refman/5.5/en/mysql-install-db.html
* http://dev.mysql.com/doc/refman/5.5/en/default-privileges.html
To run as, for instance, user "mysql", you may need to `sudo`:
sudo mysql_install_db ...options...
Start mysqld manually with:
mysql.server start
Note: if this fails, you probably forgot to run the first two steps up above
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
To connect:
mysql -uroot
To launch on startup:
* if this is your first install:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/mysql/5.5.20/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
* if this is an upgrade and you already have the homebrew.mxcl.mysql.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
cp /usr/local/Cellar/mysql/5.5.20/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
You may also need to edit the plist to use the correct "UserName".
==> Summary
/usr/local/Cellar/mysql/5.5.20: 6336 files, 221M, built in 5.6 minutes
~ → mysql.server start
Starting MySQL
.. SUCCESS!
~ → unset TMPDIR
~ → mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/Cellar/mysql/5.5.20/bin/mysqladmin -u root password 'new-password'
/usr/local/Cellar/mysql/5.5.20/bin/mysqladmin -u root -h jfsiii password 'new-password'
Alternatively you can run:
/usr/local/Cellar/mysql/5.5.20/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/local/Cellar/mysql/5.5.20 ; /usr/local/Cellar/mysql/5.5.20/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/Cellar/mysql/5.5.20/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/local/Cellar/mysql/5.5.20/scripts/mysqlbug script!
~ → mysql.server start
Starting MySQL
.. SUCCESS!
~ → /usr/local/Cellar/mysql/5.5.20/bin/mysqladmin -u root password
New password:
Confirm new password:
~ → /usr/local/Cellar/mysql/5.5.20/bin/mysqladmin -u root -h jfsiii password
New password:
Confirm new password:
~ → mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.20 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment