mac下推薦使用brew來(lái)管理軟件包儿奶,方便軟件的安裝和卸載框往,解決安裝包的依賴(lài),官網(wǎng)地址
- 安裝mysql
- 設(shè)置開(kāi)機(jī)啟動(dòng) (可選)
- 啟動(dòng)mysql
- 安裝密碼安全插件(可選)
- 修改root密碼
-- 安裝mysql
brew install mysql
-- 設(shè)置開(kāi)機(jī)啟動(dòng)
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
-- 啟動(dòng)mysql
mysql.server start
FengjxMac:~ fengjianxin$ mysql_secure_installation (修改root密碼)
Securing 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: y (是否安裝密碼安全插件闯捎,開(kāi)發(fā)環(huán)境可以選n)
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 (安全模式0低椰弊,1中等,2強(qiáng))
Please set the password for root here.
New password:(輸入新密碼)
Re-enter new password:(再次輸入新密碼)
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) : n (是否刪除匿名用戶(hù))
... skipping.
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) : n (是否禁止root遠(yuǎn)程登錄)
... 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) : y (是否刪除測(cè)試數(shù)據(jù)庫(kù))
- 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) : y (是否重新加載權(quán)限)
Success.
All done!
-- 如果不想使用復(fù)雜的密碼瓤鼻,可以不安裝或者卸載掉密碼安全插件(比如開(kāi)發(fā)環(huán)境)
-- 登錄root用戶(hù)
mysql -uroot -p
mysql> UNINSTALL PLUGIN validate_password; (卸載密碼安全插件)
Query OK, 0 rows affected (0.00 sec)
-- 再按照上面的操作秉版,使用mysql_secure_installation修改root密碼即可
** 我的博客:http://blog.fengjx.com/post/77624e8fbc9c11e6937f00163e001d4a**