Mac M1芯片安装 MySQL
生活随笔
收集整理的這篇文章主要介紹了
Mac M1芯片安装 MySQL
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Mac M1 安裝 MySQL 5.7.36.arm64
- 1、安裝環(huán)境和安裝時間
- 2、使用`brew`安裝`MySQL`
- 2.1 第一次失敗
- 2.2 根據(jù)提示執(zhí)行命令,第1次失敗,第2次開啟`VPN`再次執(zhí)行,終于成功
- 2.3 執(zhí)行如下命令(VPN開/關(guān)都試過均失敗)
- 2.4 再次按照提示安裝
- 2.5 上述步驟安裝成功后,編輯`vim ~/.zshrc`
- 2.6 再次安裝MySQL--5.7.36.arm64,成功🎉🎉
- 2.7 配置環(huán)境變量
- 2.8 查看版本
- 2.9 根據(jù)安裝👆提示,初始化,第1次失敗😔😔
- 2.9.1 繼續(xù)初始化,第2次成功🎉🎉
- 3、MySQL 常用命令
- 3.2 使用brew管理安裝的服務(wù),如Mysql、Nginx、Redis等
- 4、查看mysql進程 `ps -ef | grep mysql`
- 5、Navicat 測試連接,`Success!!`
考慮到目前生產(chǎn)環(huán)境大都用5.x,所以這里我選擇MySQL 5.7版本,而非新的MySQL 8.X版本
1、安裝環(huán)境和安裝時間
安裝環(huán)境:2021款M1MacBookPro,macOS Monterey 12系統(tǒng) Apple M1芯片 安裝時間:2021年11月20日2、使用brew安裝MySQL
2.1 第一次失敗
? ~ brew install mysql@5.7 Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)! Please create a new installation in /opt/homebrew using one of the "Alternative Installs" from:https://docs.brew.sh/Installation You can migrate your previously installed formula list with:brew bundle dump ? ~2.2 根據(jù)提示執(zhí)行命令,第1次失敗,第2次開啟VPN再次執(zhí)行,終于成功
# # 第1次執(zhí)行,失敗? ~ brew bundle dump ==> Tapping homebrew/bundle Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle'... fatal: unable to access 'https://github.com/Homebrew/homebrew-bundle/': LibreSSL SSL_connect: Operation timed out in connection to github.com:443 Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-bundle /usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle --origin=origin --template=` exited with 128. Error: Failure while executing; `/usr/local/bin/brew tap homebrew/bundle` exited with 1.# 第2次執(zhí)行,成功 ? ~ brew bundle dump ==> Tapping homebrew/bundle Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle'... remote: Enumerating objects: 6321, done. remote: Counting objects: 100% (499/499), done. remote: Compressing objects: 100% (314/314), done. remote: Total 6321 (delta 231), reused 403 (delta 182), pack-reused 5822 Receiving objects: 100% (6321/6321), 1.47 MiB | 3.44 MiB/s, done. Resolving deltas: 100% (3654/3654), done. Tapped 1 command (98 files, 1.8MB). ? ~2.3 執(zhí)行如下命令(VPN開/關(guān)都試過均失敗)
# 1. 失敗😔😔? ~ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" curl: (7) Failed to connect to raw.githubusercontent.com port 443 after 3 ms: Connection refused# 2. 更換命令后重新執(zhí)行? ~ /usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)" /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin21/rbconfig.rb:230: warning: Insecure world writable dir /Users/able/Documents/Java/Tools/Maven/apache-maven-3.3.9/bin in PATH, mode 040777 Warning: Ruby版本Homebrew安裝腳本已被廢棄,新版腳本使用Bash重寫。 請使用以下命令:/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"==> Checking for `sudo` access (which may request your password). Password: ==> This script will install: /opt/homebrew/bin/brew /opt/homebrew/share/doc/homebrew /opt/homebrew/share/man/man1/brew.1 /opt/homebrew/share/zsh/site-functions/_brew /opt/homebrew/etc/bash_completion.d/brew /opt/homebrew ==> The following new directories will be created:。。。省略。。。 。。。省略。。。 請按回車鍵(RETURN)繼續(xù)安裝,按其他任意按鍵取消安裝 ? ~# 3. 我這里果斷選擇了取消,按照👆提示使用新命令重新執(zhí)行 /bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"2.4 再次按照提示安裝
? ~ /bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)" ==> Checking for `sudo` access (which may request your password). Password: ==> This script will install: /opt/homebrew/bin/brew /opt/homebrew/share/doc/homebrew /opt/homebrew/share/man/man1/brew.1 /opt/homebrew/share/zsh/site-functions/_brew /opt/homebrew/etc/bash_completion.d/brew /opt/homebrew ==> The following new directories will be created: /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks ==> 安裝提示 中文安裝教程(建議收藏):https://brew.idayer.com/ 如果你想換源,可以使用鏡像助手:https://brew.idayer.com/guide/change-source/安裝遇到問題,可以通過討論群尋求幫助。 也歡迎加群討論,掃碼關(guān)注公眾號(湖中劍),回復(fù)'brew'加入討論群。█████████████████████████████████████ █████████████████████████████████████ ████ ▄▄▄▄▄ █?█ █▄?▄ ▄ ▄▄██ ▄▄▄▄▄ ████ ████ █ █ █???█ ?█????▄?█ █ █ ████ ████ █▄▄▄█ █? █??█▄? █?▄ █ █▄▄▄█ ████ ████▄▄▄▄▄▄▄█▄? ?▄█▄? █▄? █▄▄▄▄▄▄▄████ ████ ?▄▄▄▄?▄?▄▄█??█ █ ? ?▄█▄?████ ████ ?█▄??▄ █▄█?█ ▄██ █ ? ▄▄██?█████ ████ █ █▄ ▄ ▄█▄ ? ██ ? ???▄ █?████ ████ ██▄██▄? █ ▄█? ▄▄?? ? █▄█▄?█████ ████ ▄ ?▄▄▄?█▄ ▄? ? ?█? ?? █?████ ████ █ ???▄█▄█▄█?█?▄ █??▄▄█▄▄▄▄?█████ ████▄██▄▄█▄█???█▄█▄ ?▄?█ ▄▄▄ ? ████ ████ ▄▄▄▄▄ █▄? ▄█▄ ▄? █▄█ ▄?█████ ████ █ █ █ ?▄▄ ?▄ ?███ ▄▄▄▄ ▄? ████ ████ █▄▄▄█ █ ▄▄? ██▄?▄?▄ ?▄ ▄ █████ ████▄▄▄▄▄▄▄█▄▄█▄▄████▄█████▄▄█▄██████ █████████████████████████████████████ █████████████████████████████████████請按回車鍵(RETURN)繼續(xù)安裝,按其他任意按鍵取消安裝 ==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew ==> /usr/bin/sudo /usr/sbin/chown root:wheel /opt/homebrew ==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks ==> /usr/bin/sudo /bin/chmod u=rwx,g=rwx /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks ==> /usr/bin/sudo /bin/chmod g-w,o-w /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions ==> /usr/bin/sudo /usr/sbin/chown able /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks ==> /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks ==> /usr/bin/sudo /usr/sbin/chown -R able:admin /opt/homebrew ==> Downloading and installing Homebrew... remote: Enumerating objects: 197481, done. remote: Counting objects: 100% (197481/197481), done. remote: Compressing objects: 100% (45950/45950), done. remote: Total 197481 (delta 146750), reused 197360 (delta 146703) 接收對象中: 100% (197481/197481), 52.25 MiB | 11.04 MiB/s, 完成. 處理 delta 中: 100% (146750/146750), 完成. 來自 https://mirrors.ustc.edu.cn/brew* [新分支] master -> origin/master* [新標簽] 0.1 -> 0.1* [新標簽] 0.2 -> 0.2 。。。省略。。。 。。。省略。。。* [新標簽] 3.3.4 -> 3.3.4 remote: Enumerating objects: 7531, done. remote: Counting objects: 100% (7531/7531), done. remote: Compressing objects: 100% (1581/1581), done. remote: Total 7531 (delta 5798), reused 7531 (delta 5798) 接收對象中: 100% (7531/7531), 1.61 MiB | 9.33 MiB/s, 完成. 處理 delta 中: 100% (5798/5798), 完成 737 個本地對象. 來自 https://mirrors.ustc.edu.cn/brew* [新標簽] 1.1.0.1 -> 1.1.0.1* [新標簽] 1.1.2.1 -> 1.1.2.1* [新標簽] 1.2.7 -> 1.2.7* [新標簽] 1.2.8 -> 1.2.8* [新標簽] backup/activesupport-23-38-09 -> backup/activesupport-23-38-09* [新標簽] backup/brew-cask-style-14-54-55 -> backup/brew-cask-style-14-54-55* [新標簽] backup/create-cache-00-29-47 -> backup/create-cache-00-29-47* [新標簽] backup/days-03-02-52 -> backup/days-03-02-52* [新標簽] backup/days-03-02-59 -> backup/days-03-02-59* [新標簽] backup/days-19-30-23 -> backup/days-19-30-23* [新標簽] backup/gpg-verification-01-53-16 -> backup/gpg-verification-01-53-16* [新標簽] backup/remove-popen-read-19-56-50 -> backup/remove-popen-read-19-56-50* [新標簽] backup/remove-popen-read-20-00-21 -> backup/remove-popen-read-20-00-21 HEAD 現(xiàn)在位于 27a76295a Merge pull request #12279 from bayandin/synced-versions-formulae ==> Tapping homebrew/core remote: Enumerating objects: 1096372, done. remote: Total 1096372 (delta 0), reused 0 (delta 0) 接收對象中: 100% (1096372/1096372), 449.59 MiB | 8.45 MiB/s, 完成. 處理 delta 中: 100% (761972/761972), 完成. 來自 https://mirrors.ustc.edu.cn/homebrew-core* [新分支] master -> origin/master HEAD 現(xiàn)在位于 cdb7b8a636b dxpy: update 0.316.0 bottle. HOMEBREW_BREW_GIT_REMOTE set: using https://mirrors.ustc.edu.cn/brew.git for Homebrew/brew Git remote. HOMEBREW_CORE_GIT_REMOTE set: using https://mirrors.ustc.edu.cn/homebrew-core.git for Homebrew/core Git remote. Warning: !!!!!!!!!!! 重要 !!!!!!!!!!!!!!! Warning: 看到此提示,一定要執(zhí)行 Next steps 中的 環(huán)境變量設(shè)置!!! Warning: /opt/homebrew/bin is not in your PATH. ==> Installation successful!==> Homebrew has enabled anonymous aggregate formulae and cask analytics. Read the analytics documentation (and how to opt-out) here:https://docs.brew.sh/Analytics No analytics data has been sent yet (or will be during this `install` run).==> Homebrew is run entirely by unpaid volunteers. Please consider donating:https://github.com/Homebrew/brew#donations==> Next steps: Warning: !!!!!!!!!!! 重要 !!!!!!!!!!!!!!! 切記執(zhí)行環(huán)境變量設(shè)置!,如已執(zhí)行過請忽略。 - 執(zhí)行下面命令將 Homebrew 到 PATH 中:echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/able/.zprofileeval "$(/opt/homebrew/bin/brew shellenv)"如有疑問,可以訪問 https://brew.idayer.com/guide/m1/ - 🎉 恭喜,安裝成功!運行 `brew help` 開始體驗吧 - 更多文檔:https://docs.brew.shhttps://brew.idayer.com# 按照提示執(zhí)行如下命令??##########################################? ~ echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/able/.zprofile ? ~ eval "$(/opt/homebrew/bin/brew shellenv)" ? ~2.5 上述步驟安裝成功后,編輯vim ~/.zshrc
# 編輯 vim ~/.zshrc# 添加如下 export PATH=/opt/homebrew/bin:$PATH# 最后更新配置 source ~/.zshrc2.6 再次安裝MySQL–5.7.36.arm64,成功🎉🎉
? ~ brew install mysql@5.7 ==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2021-10-26 ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/blobs/sha256:1bbd45c16a0b9912174c553a6d7ae1b67b11abbeb3155eaf03109bb62d8e5381 ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:1bbd45c16a0b9912174c553a6d7ae1b67b11abbeb3155eaf03109bb62d8e5381?se=2021-11-19T19%3A20%3A00Z&sig=YV2WZmrg7Y8%2BBqjj7wSpM4iTdi6LJRyCWiUoxA8FWic%3D&sp=r&spr=https ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/manifests/1.1.1l_1 ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/blobs/sha256:8f5b0bee61c1570b9f0fc0a21d6c322e904ae7975bdaada5787451d18e9677a6 ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:8f5b0bee61c1570b9f0fc0a21d6c322e904ae7975bdaada5787451d18e9677a6?se=2021-11-19T19%3A20%3A00Z&sig=rNOAwBwDZASv%2F7jIhWjs4SmMJwqLWg6FHzMIPv3zULE%3D&sp=r&spr=https ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/mysql/5.7/manifests/5.7.36 ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/mysql/5.7/blobs/sha256:e23df0f6e8bfc83fe2e982ec60e89be6ca069d35f96981ea6073591563bf7917 ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:e23df0f6e8bfc83fe2e982ec60e89be6ca069d35f96981ea6073591563bf7917?se=2021-11-19T19%3A20%3A00Z&sig=hHHMGyBxYIbP0aCUj9%2BWQ1WQK%2B2j9FdIcyiAw%2Bjc53Y%3D&sp=r&spr=h ######################################################################## 100.0% ==> Installing dependencies for mysql@5.7: ca-certificates and openssl@1.1 ==> Installing mysql@5.7 dependency: ca-certificates ==> Pouring ca-certificates--2021-10-26.all.bottle.tar.gz ==> Regenerating CA certificate bundle from keychain, this may take a while... 🍺 /opt/homebrew/Cellar/ca-certificates/2021-10-26: 3 files, 208.5KB ==> Installing mysql@5.7 dependency: openssl@1.1 ==> Pouring openssl@1.1--1.1.1l_1.arm64_monterey.bottle.tar.gz 🍺 /opt/homebrew/Cellar/openssl@1.1/1.1.1l_1: 8,073 files, 18MB ==> Installing mysql@5.7 ==> Pouring mysql@5.7--5.7.36.arm64_big_sur.bottle.tar.gz ==> /opt/homebrew/Cellar/mysql@5.7/5.7.36/bin/mysqld --initialize-insecure --user=able --basedir=/opt/homebrew/Cellar/mysql@5.7/5.7.36 --datadir=/opt/homebrew/var/mysql --tmpdir=/tmp ==> Caveats We've installed your MySQL database without a root password. To secure it run:mysql_secure_installationMySQL is configured to only allow connections from localhost by defaultTo connect run:mysql -urootmysql@5.7 is keg-only, which means it was not symlinked into /opt/homebrew, because this is an alternate version of another formula.If you need to have mysql@5.7 first in your PATH, run:echo 'export PATH="/opt/homebrew/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrcFor compilers to find mysql@5.7 you may need to set:export LDFLAGS="-L/opt/homebrew/opt/mysql@5.7/lib"export CPPFLAGS="-I/opt/homebrew/opt/mysql@5.7/include"To restart mysql@5.7 after an upgrade:brew services restart mysql@5.7 Or, if you don't want/need a background service you can just run:/opt/homebrew/opt/mysql@5.7/bin/mysqld_safe --datadir=/opt/homebrew/var/mysql ==> Summary 🍺 /opt/homebrew/Cellar/mysql@5.7/5.7.36: 320 files, 233.3MB ==> Caveats ==> mysql@5.7 We've installed your MySQL database without a root password. To secure it run:mysql_secure_installationMySQL is configured to only allow connections from localhost by defaultTo connect run:mysql -urootmysql@5.7 is keg-only, which means it was not symlinked into /opt/homebrew, because this is an alternate version of another formula.If you need to have mysql@5.7 first in your PATH, run:echo 'export PATH="/opt/homebrew/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrcFor compilers to find mysql@5.7 you may need to set:export LDFLAGS="-L/opt/homebrew/opt/mysql@5.7/lib"export CPPFLAGS="-I/opt/homebrew/opt/mysql@5.7/include"To restart mysql@5.7 after an upgrade:brew services restart mysql@5.7 Or, if you don't want/need a background service you can just run:/opt/homebrew/opt/mysql@5.7/bin/mysqld_safe --datadir=/opt/homebrew/var/mysql? ~2.7 配置環(huán)境變量
# ##################按照上面👆安裝提示執(zhí)行如下👇命令#################echo 'export PATH="/opt/homebrew/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc# 編輯 vim ~/.zshrc# 根據(jù)安裝提示,添加如下配置 export LDFLAGS="-L/opt/homebrew/opt/mysql@5.7/lib" export CPPFLAGS="-I/opt/homebrew/opt/mysql@5.7/include"# 最后更新配置 source ~/.zshrc2.8 查看版本
? ~ mysql --version mysql Ver 14.14 Distrib 5.7.36, for osx10.16 (x86_64) using EditLine wrapper2.9 根據(jù)安裝👆提示,初始化,第1次失敗😔😔
任意路徑執(zhí)行命令:mysql_secure_installation,交互過程中不斷輸入y或者n,可以修改密碼。
? ~ mysql.server statusERROR! MySQL is not running# 初始化,失敗!! ? ~ mysql_secure_installationSecuring the MySQL server deployment.Enter password for user root: Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)# ??找到👆安裝日志,根據(jù)提示操作,啟動成功? ~ brew services restart mysql@5.7==> Tapping homebrew/services Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-services'... remote: Enumerating objects: 1529, done. remote: Counting objects: 100% (408/408), done. remote: Compressing objects: 100% (297/297), done. remote: Total 1529 (delta 169), reused 284 (delta 101), pack-reused 1121 Receiving objects: 100% (1529/1529), 447.19 KiB | 1.45 MiB/s, done. Resolving deltas: 100% (645/645), done. Tapped 1 command (38 files, 557KB). ==> Successfully ran `mysql@5.7` (label: homebrew.mxcl.mysql@5.7)# 查看MySQL啟動狀態(tài)? ~ mysql.server statusSUCCESS! MySQL running (62019)2.9.1 繼續(xù)初始化,第2次成功🎉🎉
? ~ mysql_secure_installationSecuring the MySQL server deployment.Connecting to MySQL using a blank password.VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin?Press y|Y for Yes, any other key for No: no # Setp1:如果選yes的話密碼長度就必須要設(shè)置為8位以上,我只想要6位的 Please set the password for root here.New password: 123456 # Step2:為root設(shè)置密碼Re-enter new password: # Step3:再次輸入上面👆密碼 123456 By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.Remove anonymous users? (Press y|Y for Yes, any other key for No) : y Success. # Step4:移除不用密碼的那個賬戶Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.Disallow root login remotely? (Press y|Y for Yes, any other key for No) : no # Step5:拒絕root遠程登錄... skipping. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.Remove test database and access to it? (Press y|Y for Yes, any other key for No) : yes # Step6:刪除text數(shù)據(jù)庫,對我來說沒什么用,酌情刪/留- Dropping test database... Success.- Removing privileges on test database... Success.Reloading the privilege tables will ensure that all changes made so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) : yes # Step7:yes重新加載權(quán)限表將確保所有更改 Success.All done! # 成功🎉🎉🎉🎉🎉🎉3、MySQL 常用命令
| 查看MySQL狀態(tài) | mysql.server status |
| 啟動MySQL | mysql.server start |
| 停止MySQL | mysql.server stop |
| 重啟MySQL | mysql.server restart |
3.2 使用brew管理安裝的服務(wù),如Mysql、Nginx、Redis等
brew services 用于管理使用brew安裝的服務(wù),如Mysql、Nginx、Redis等| brew services list | 查看服務(wù)與運行狀態(tài) |
| brew services start mysql | 開啟mysql服務(wù) |
| brew services stop mysql | 停止mysql服務(wù) |
| brew services restart mysql | 重起mysql服務(wù) |
| --------------------------- | --------------------- |
| brew services start --all | 開啟所有服務(wù) |
| brew services stop --all | 停止所有服務(wù) |
| brew services restart --all | 重起所有服務(wù) |
4、查看mysql進程 ps -ef | grep mysql
? ~ ps -ef | grep mysql501 76120 1 0 4:09上午 ?? 0:00.02 /bin/sh /opt/homebrew/opt/mysql@5.7/bin/mysqld_safe --datadir=/opt/homebrew/var/mysql501 76208 76120 0 4:09上午 ?? 0:00.18 /opt/homebrew/opt/mysql@5.7/bin/mysqld --basedir=/opt/homebrew/opt/mysql@5.7 --datadir=/opt/homebrew/var/mysql --plugin-dir=/opt/homebrew/opt/mysql@5.7/lib/plugin --log-error=Able-MacBook-Pro.local.err --pid-file=Able-MacBook-Pro.local.pid501 76220 1 0 4:09上午 ttys001 0:00.01 /bin/sh /opt/homebrew/Cellar/mysql@5.7/5.7.36/bin/mysqld_safe --datadir=/opt/homebrew/var/mysql --pid-file=/opt/homebrew/var/mysql/Able-MacBook-Pro.local.pid501 76319 76220 0 4:09上午 ttys001 0:00.16 /opt/homebrew/Cellar/mysql@5.7/5.7.36/bin/mysqld --basedir=/opt/homebrew/Cellar/mysql@5.7/5.7.36 --datadir=/opt/homebrew/var/mysql --plugin-dir=/opt/homebrew/Cellar/mysql@5.7/5.7.36/lib/plugin --log-error=Able-MacBook-Pro.local.err --pid-file=/opt/homebrew/var/mysql/Able-MacBook-Pro.local.pid501 76609 75348 0 4:10上午 ttys001 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox mysql ? ~5、Navicat 測試連接,Success!!
最后喜歡的小伙伴,記得關(guān)注收藏哦!😏🍭😘
總結(jié)
以上是生活随笔為你收集整理的Mac M1芯片安装 MySQL的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【网络攻防课实验】一:本地系统密码破解
- 下一篇: AHU计科(伪)新生指南