Mac使用brew安装mysql并将脚本数据导入数据库

本文介绍了如何在Mac上使用brew安装MySQL,通过命令行导入sql脚本到数据库,以及如何处理安装和使用过程中的常见问题,如设置root密码、访问权限错误等。
摘要由CSDN通过智能技术生成

一、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用户密码

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值