1.brew install mysql@5.7
2.
? echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc
? export LDFLAGS="-L/usr/local/opt/mysql@5.7/lib"
? export CPPFLAGS="-I/usr/local/opt/mysql@5.7/include"
3.brew services start mysql@5.7
4.mysql_secure_installation
輸入以上命令后,出現(xiàn)如下:
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD COMPONENT 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 component?
// 提示是否設(shè)置密碼
Press y|Y for Yes, any other key for No: y
// 提示選擇密碼強(qiáng)度等級(jí)
There are three levels of password validation policy:
LOW ? ?Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary ? ? ? ? ? ? ? ? ?file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Please set the password for root here.
// 按照所選的密碼強(qiáng)度要求設(shè)定密碼
New password:
Re-enter new password:
// 提示密碼強(qiáng)度50,不符合要求重新設(shè)置密碼
Estimated strength of the password: 50
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
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.
// 提示刪除默認(rèn)無(wú)密碼用戶
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
// 提示禁止遠(yuǎn)程root登錄
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.
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.
// 提示刪除默認(rèn)自帶的test數(shù)據(jù)庫(kù)
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
?- 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.
// 提示是否重新加載privilege tables
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!
?文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-616784.html
5.brew services start mysql和mysql.server start區(qū)別文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-616784.html
# 后臺(tái)啟動(dòng)
brew service start mysql
# 前臺(tái)啟動(dòng),關(guān)閉控制臺(tái),服務(wù)停止
mysql.server start
到了這里,關(guān)于mac brew安裝mysql5.7并配置環(huán)境的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!