(1)下载安装

image.png

  • 一般我们使用5.7版本

image.png

  • 安装中需要记下密码:CgUasPdNy3(s

image.png

(2)服务启动与关闭

image.pngimage.png

(3)环境配置

  • .bash_profile文件中环境变量添加

    mysql

    export PATH=${PATH}:/usr/local/mysql/bin

  • 登录

  • 修改密码

    登录:mysql -u root -p 登录后修改密码(括号中为新密码):SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘root’); 退出:quit

  1. wangchundeMacBook-Pro:~ wangchun$ mysql -u root -p
  2. Enter password:
  3. Welcome to the MySQL monitor. Commands end with ; or \g.
  4. Your MySQL connection id is 177
  5. Server version: 5.7.31 MySQL Community Server (GPL)
  6. Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
  7. Oracle is a registered trademark of Oracle Corporation and/or its
  8. affiliates. Other names may be trademarks of their respective
  9. owners.
  10. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  11. mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root');
  12. Query OK, 0 rows affected, 1 warning (0.00 sec)
  13. mysql> quit
  14. Bye
  15. wangchundeMacBook-Pro:~ wangchun$

(4)MySQL可视化工具