MySQLをHomebrewでインストールする(Mac版)
新しいMacに変えたのでローカルにMySQLをインストールする必要が出てきました。
そのときにbrewでインストールすると2分くらいでインストールが完了したので、今日はそのことを書きたいと思います。
先程の書いたように、 MacでMySQLをインストールするにはHomebrewを使用します!
%brew install mysql
ずらーと色んな英単語が表示されてると思います。 インストールが完了したらキチンとインストールされているか確認しましょう!
% brew info mysql mysql: stable 5.7.17 (bottled) Open source relational database management system https://dev.mysql.com/doc/refman/5.7/en/ Conflicts with: mariadb, mariadb-connector-c, mysql-cluster, mysql-connector-c, percona-server Not installed From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mysql.rb ==> Dependencies Build: cmake ✘ Required: openssl ✘ ==> Requirements Required: macOS >= 10.7 ✔ ==> Options --with-archive-storage-engine Compile with the ARCHIVE storage engine enabled --with-blackhole-storage-engine Compile with the BLACKHOLE storage engine enabled --with-debug Build with debug support --with-embedded Build the embedded server --with-local-infile Build with local infile loading support --with-test Build with unit tests ==> Caveats We've installed your MySQL database without a root password. To secure it run: mysql_secure_installation To connect run: mysql -uroot To have launchd start mysql now and restart at login: brew services start mysql Or, if you don't want/need a background service you can just run: mysql.server start
バージョン5.7.17のMySQLがインストールされているみたいですね。
起動方法も書いありました。
下記どちらかのコマンドを叩けばローカルでMySQLを起動してくれます。
%brew services start mysql %mysql.server start
以上でインストールは完了です!
最後に起動確認もしてみます。
% mysql.server start Starting MySQL . SUCCESS!
ちゃんと起動しました。
おわり!!