- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2022-04-19T05:20:01+00:00","default:src128","src128")
&tag(Homebrew/mysql);
*目次 [#id978086]
#contents
*参考情報 [#r126b57e]
-[[Homebrew]]
-[[./古い情報]]
-[[./古い情報20220419]]
*インストール [#u945690f]
-普通にインストールすると、5.6が入る
*インストール: 2022/04/19(火) [#a9bb8726]
-以下のコマンドでインストール。
brew install mysql
-データベース初期化。
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
*自動起動 [#pabdf864]
-自分でplistを登録する。
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
*サーバー起動 [#wbecb597]
-mysql.serverコマンドで操作できる。
mysql.server start
-MySQL 8がインストールされる。
-以下の情報が表示される。
#pre{{
==> Caveats
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
*rootのパスワード設定 [#s0cda662]
-mysqladminを使う
mysqladmin -uroot password
To connect run:
mysql -uroot
To restart mysql after an upgrade:
brew services restart mysql
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/mysql/bin/mysqld_safe --datadir=/opt/homebrew/var/mysql
==> Summary
🍺 /opt/homebrew/Cellar/mysql/8.0.28_1: 304 files, 294.3MB
==> Running `brew cleanup mysql`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> mysql
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -uroot
To restart mysql after an upgrade:
brew services restart mysql
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/mysql/bin/mysqld_safe --datadir=/opt/homebrew/var/mysql
}}
-/opt/homebrew/etc/my.cnfがある。
-サーバーを実行(これをしないとmysql_secure_installationが実行できない)。
brew services restart mysql
-以下のコマンドを実行して初回セットアップ実行(homeの.my.cnfはリネームしておく)
mysql_secure_installation
-とりあえず「VALIDATE PASSWORD COMPONENT」は無効。rootのパスワードを設定。