文章目录
一、Mac使用brew安装mysql
-
安装mysql:
brew install mysql
。brew 是Mac电脑用户用于安装、卸载、更新各种软件包的包管理工具。
安装完成后,终端会给出一些提示及相关命令:
-
启动mysql:
mysql.server start
。- mysql启动成功会提示 Starting MySQL … SUCCESS!。
- 如果mysql服务没有启动,会报错:Error: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
-
为了提高mysql库的安全性,可执行
mysql_secure_installation
来设置root用户密码。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:是否设置验证密码?
Please set the password for root here.
New password:输入root用户密码
Re-enter new password:再次输入root用户密码