Mac下安裝MySQL簡單到想哭,基本上就是brew搜索一下,安裝曙博,啟動晓淀,即可。
$ brew install mysql
$ mysql.server start
如果想停止鸯屿,可以使用:
$ mysql.server stop
以下是我的機器上俩檬,brew search/info的輸出,尤其是最后的啟動命令碾盟,很有用棚辽。
bash-3.2$ brew search mysql
automysqlbackup mysql-cluster mysql-sandbox mysql@5.5
mysql ? mysql-connector-c mysql-search-replace mysql@5.6
mysql++ mysql-connector-c++ mysql-utilities mysqltuner
caskroom/cask/mysql-connector-python caskroom/cask/sqlpro-for-mysql caskroom/cask/navicat-for-mysql
caskroom/cask/mysql-utilities caskroom/cask/mysql-shell
bash-3.2$ brew info mysql
mysql: stable 5.7.19 (bottled)
Open source relational database management system
https://dev.mysql.com/doc/refman/5.7/en/
Conflicts with:
mariadb (because mysql, mariadb, and percona install the same binaries.)
mariadb-connector-c (because both install plugins)
mysql-cluster (because mysql, mariadb, and percona install the same binaries.)
mysql-connector-c (because both install MySQL client libraries)
percona-server (because mysql, mariadb, and percona install the same binaries.)
/usr/local/Cellar/mysql/5.7.19 (322 files, 233MB) *
Poured from bottle on 2017-07-24 at 19:26:40
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
MySQL is configured to only allow connections from localhost by default
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