美文网首页
MySQL学习 01 安装 基于MacOS

MySQL学习 01 安装 基于MacOS

作者: LuckyBugGo | 来源:发表于2019-07-18 13:35 被阅读0次

    在Mac环境使用brew安装MySQL

    brew install mysql
    

    基于brew操作mysql服务

    # 查看服务列表
    brew services list
    # 启动mysql
    brew services start mysql
    # 停止mysql
    brew services stop mysql
    # 重启mysql
    brew services restart mysql
    

    MySQL的初始化配置

    在MySQL安装完成之后,设置root用户和密码等初始化配置。
    执行mysql_secure_installation启动配置脚本

    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: y   //使用密码验证
    
    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.
    
    New password:    // 输入新密码
    
    Re-enter new password: 
    
    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.
    
    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 // 是否禁止远程登录
    
     ... 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  // 是否删除测试库
     - 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!   // 完成
    

    使用工具连接数据库

    推荐使用 Navicat Premium 工具。

    图片.png

    相关文章

      网友评论

          本文标题:MySQL学习 01 安装 基于MacOS

          本文链接:https://www.haomeiwen.com/subject/fdfllctx.html