1、安装

在终端termial执行命令:brew install mysql, 然后默默等待 。。。。。。。。。

图2

 

2、启动

mysql.server start

出现

3、初始化

任意路径执行命令:mysql_secure_installation,交互过程中不断输入y或者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?

 

Press y|Y for Yes, any other key for No: n    // 这个选yes的话密码长度就必须要设置为8位以上,但我只想要6位的

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) : 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.

 

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n      //不接受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) : y     //删除text数据库

- 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

Success.

 

All done!

安装完成

4、停止

mysql.server stop

5、查看状态 

mysql.server status 或者 ps -ef|grep mysqld

GitHub 加速计划 / br / brew
40.4 K
9.47 K
下载
🍺 The missing package manager for macOS (or Linux)
最近提交(Master分支:22 天前 )
90a90b30 2 个月前
47b1cab7 2 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐