From 4a90e1087bae57b94366140955c75efdcce6601a Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 19 Nov 2015 10:06:35 +0000 Subject: [PATCH] mysql: default to no root password (like 5.6). Point the users to the relevant command so they can secure it more if they wish. Closes Homebrew/homebrew#46159. Signed-off-by: Mike McQuaid --- Formula/mysql.rb | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Formula/mysql.rb b/Formula/mysql.rb index b1a7ebdf77..afbb44d1d9 100644 --- a/Formula/mysql.rb +++ b/Formula/mysql.rb @@ -134,18 +134,27 @@ class Mysql < Formula datadir.mkpath unless (datadir/"mysql/user.frm").exist? ENV["TMPDIR"] = nil - system bin/"mysqld", "--initialize", "--user=#{ENV["USER"]}", + system bin/"mysqld", "--initialize-insecure", "--user=#{ENV["USER"]}", "--basedir=#{prefix}", "--datadir=#{datadir}", "--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. + def caveats + s = <<-EOS.undent + We've installed your MySQL database without a root password. To secure it run: + mysql_secure_installation - To connect: + To connect run: mysql -uroot EOS + if File.exist? "/etc/my.cnf" + s += <<-EOS.undent + + A "/etc/my.cnf" from another install may interfere with a Homebrew-built + server starting up correctly. + EOS + end + s end plist_options :manual => "mysql.server start"