首页 > 数据库 >MAC 安装 MySQL

MAC 安装 MySQL

时间:2022-12-21 15:13:28浏览次数:72  
标签:5.7 安装 MySQL start MAC usr mysql brew local

安装

# 查询mysql 版本
➜  ~ brew search mysql
==> Formulae
automysqlbackup            [email protected]           [email protected]
mysql                      mysql-connector-c++        [email protected]
mysql++                    mysql-sandbox              mysqltuner
mysql-client               mysql-search-replace       qt-mysql
==> Casks
mysql-connector-python     mysql-utilities            navicat-for-mysql
mysql-shell                mysqlworkbench             sqlpro-for-mysql

# 安装指定版本
brew install [email protected]

# 安装成功后的界面信息
MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

[email protected] is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have [email protected] first in your PATH, run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"


To start [email protected]:
  brew services start [email protected]
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/[email protected]/bin/mysqld_safe --datadir=/usr/local/var/mysql
==> Summary

-- 启动
brew services start [email protected]
-- 登录
mysql -uroot -p
# 后台启动
brew services start mysql
# 启动
mysql.server start

# 连接本机 localhost:3306 服务
mysql -uroot -p
# 连接指定host 的mysql服务
mysql -h 192.21.12.42 -P 3306 -u root -p

# 停止
mysql.server stop

# 重启
mysql.server restart

参考:https://www.jianshu.com/p/11ce77ceab3d
https://newsn.net/say/brew-install-mysql57.html

标签:5.7,安装,MySQL,start,MAC,usr,mysql,brew,local
From: https://www.cnblogs.com/yansq0/p/16996296.html

相关文章