Mac 安装mysql

MacBook-Air:~ huangyong$ brew install mysql

==> 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

==> Summary

🍺  /usr/local/Cellar/mysql/5.7.18_1: 321 files, 232.9MB

启动mysql

MacBook-Air:~ huangyong$ brew services start mysql

==> Tapping homebrew/services

Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...

remote: Counting objects: 10, done.

remote: Compressing objects: 100% (7/7), done.

remote: Total 10 (delta 0), reused 5 (delta 0), pack-reused 0

Unpacking objects: 100% (10/10), done.

Tapped 0 formulae (37 files, 52.2KB)

==> Successfully started `mysql` (label: homebrew.mxcl.mysql)

MacBook-Air:~ huangyong$ mysql -uroot

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.7.18 Homebrew

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

停止mysql服务:

MacBook-Air:~ huangyong$ brew services stop mysql

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容