aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
authorMike McQuaid2013-04-01 20:33:54 +0100
committerMike McQuaid2013-04-01 22:13:33 +0100
commit734f082db9da334eb66f9122e916161db9e69618 (patch)
tree2fb040ca62c3552a5a10ae42f4cbd90f7843f5d9 /Library/Formula
parent391aa8408e4c3f7cd0706a96b8cdc403ede6776d (diff)
downloadhomebrew-734f082db9da334eb66f9122e916161db9e69618.tar.bz2
mysql: fix creation of var/mysql when pouring.
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/mysql.rb27
1 files changed, 10 insertions, 17 deletions
diff --git a/Library/Formula/mysql.rb b/Library/Formula/mysql.rb
index 59163ec64..e717ee295 100644
--- a/Library/Formula/mysql.rb
+++ b/Library/Formula/mysql.rb
@@ -46,9 +46,6 @@ class Mysql < Formula
# compilation of gems and other software that queries `mysql-config`.
ENV.minimal_optimization
- # Make sure the var/mysql directory exists
- (var+"mysql").mkpath
-
args = [".",
"-DCMAKE_INSTALL_PREFIX=#{prefix}",
"-DMYSQL_DATADIR=#{var}/mysql",
@@ -116,22 +113,18 @@ class Mysql < Formula
mv "#{bin}/mysqlaccess.conf", libexec
end
- def caveats; <<-EOS.undent
- Set up databases to run AS YOUR USER ACCOUNT with:
- unset TMPDIR
- mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=#{var}/mysql --tmpdir=/tmp
-
- To set up base tables in another folder, or use a different user to run
- mysqld, view the help for mysql_install_db:
- mysql_install_db --help
-
- and view the MySQL documentation:
- * http://dev.mysql.com/doc/refman/5.6/en/mysql-install-db.html
- * http://dev.mysql.com/doc/refman/5.6/en/default-privileges.html
+ def post_install
+ # Make sure the var/mysql directory exists
+ (var+"mysql").mkpath
- To run as, for instance, user "mysql", you may need to `sudo`:
- sudo mysql_install_db ...options...
+ unless File.exist? "#{var}/mysql/mysql/user.frm"
+ ENV['TMPDIR'] = nil
+ system "#{bin}/mysql_install_db", '--verbose', "--user=#{ENV['USER']}",
+ "--basedir=#{prefix}", "--datadir=#{var}/mysql", "--tmpdir=/tmp"
+ end
+ end
+ def caveats; <<-EOS.undent
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.