在Mac OS环境下安装MySQL服务

                                         作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

  我之前介绍过window环境下安装mysql服务,以及在Linux环境下安装mysql服务,今天我要给大家介绍的是在Mac环境下安装mysql服务。其实安装mysql服务我们也可以像Linux那样,使用brew命令进行安装,但我们此处使用的是绿色方式安装。

 

 

一.下载mysql服务

1>.登录mysql的下载列表

  下载地址:https://dev.mysql.com/downloads/mysql/。如下图所示,点击标红的标签。

 2>.下载DMG版本的mysql安装包

3>.跳过登录直接下载mysql服务即可

二.安装mysql服务

1>.双击运行下载好的安装包,点击继续

2>.阅读软件许可协议后,点击继续

3>.点击安装

4>.记住安装的数据库的初始密码(如下图所示,我这里的初始化密码是:M7Rju)ofMFMb)

5>.安装成功

三.启动mysql服务

1>.进入mysql的系统偏好设置

2>.点击mysql服务

3>.启动mysql服务

4>. 服务启动成功

 

四.修改mysql的默认密码

1>.登录mysql服务器

2>.更改mysql的默认密码

set password for 'root'@'localhost' = PASSWORD('yinzhengjie');

3>.使用修改后的密码登录服务器

五>.授权mysql远程主机登录

1>.授权只运行的主机

[尹正杰到此一游:~ yinzhengjie$ mysql -u root -pyinzhengjie
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 35
Server version: 5.7.24 MySQL Community Server (GPL)Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.[mysql>
[mysql>
[mysql>
[mysql>
[mysql> grant all privileges on *.* to 'root'@'172.30.1.%' identified by 'yinzhengjie';
Query OK, 0 rows affected, 1 warning (0.00 sec)[mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)[mysql> quit
Bye
[尹正杰到此一游:~ yinzhengjie$ 

2>.查看宿主机的IP地址

3>.使用Guest虚拟机登录宿主机

六.安装MySQL8.0.x的区别

1>.MySQL加密方式的选择(之前的安装步骤和上面MySQL5.7的安装方式基本雷同,我这里就省略了~)

2>.自定义root的密码:

3>.安装成功后,点击完成

4>.在MacOS到系统偏好设置进入到MySQL到管理界面

5>.查看MySQL的默认配置

6>.登陆MySQL服务器

7>.将MySQL的安装路径手动添加到环境变量中

bogon:~ yinzhengjie$ vi ~/.bash_profile
bogon:~ yinzhengjie$
bogon:~ yinzhengjie$ source  ~/.bash_profile
bogon:~ yinzhengjie$
bogon:~ yinzhengjie$ cat  ~/.bash_profile  | grep PATH
# Setting PATH for Python 3.6
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}:/usr/local/mysql/bin"
export PATH
bogon:~ yinzhengjie$
bogon:~ yinzhengjie$ mysql -uroot -pyinzhengjie
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.14 MySQL Community Server - GPLCopyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)mysql> 

8>.创建MySQL到登陆用户

mysql> CREATE USER 'yinzhengjie'@'172.30.1.10%' IDENTIFIED BY 'yinzhengjie';
Query OK, 0 rows affected (0.01 sec)mysql>
mysql> GRANT ALL PRIVILEGES ON *.* TO 'yinzhengjie'@'172.30.1.10%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)mysql> 

[root@node110 ~]# hostname
node110.yinzhengjie.org.cn
[root@node110 ~]#
[root@node110 ~]# hostname -i
172.30.1.110
[root@node110 ~]#
[root@node110 ~]# mysql -h 172.30.1.2 -uyinzhengjie -pyinzhengjie
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1130 (HY000): Host '172.30.1.110' is not allowed to connect to this MySQL server
[root@node110 ~]#
[root@node110 ~]# 

使用 “node110.yinzhengjie.org.cn” 节点登陆

[root@node105 ~]# hostname
node105.yinzhengjie.org.cn
[root@node105 ~]#
[root@node105 ~]# hostname -i
172.30.1.105
[root@node105 ~]#
[root@node105 ~]# mysql -h 172.30.1.2 -uyinzhengjie -pyinzhengjie
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.14 MySQL Community Server - GPLCopyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)mysql> quit
Bye
[root@node105 ~]# 

使用 “node105.yinzhengjie.org.cn” 节点登陆

转载于:https://www.cnblogs.com/yinzhengjie/p/10125609.html

在Mac OS环境下安装MySQL服务相关推荐

  1. Linux环境下安装MySQL(源码安装)

    Linux环境下安装MySQL(源码安装) 1.事先从官网/国内镜像站点中下载源码安装包,上传至服务器: 2.安装开发工具和开发包(从5.5开始使用cmake编译) 3.创建用户和组 4.编译安装My ...

  2. linux 查看mysql安装目录_Linux环境下安装MySQL数据库示例教程

    点击上方SQL数据库开发,关注获取SQL视频教程 SQL专栏 SQL数据库基础知识汇总 SQL数据库高级知识汇总 Linux环境对大多数SQL初学者还是比较陌生,今天给大家演示一下如何在Linux环境 ...

  3. linux centos7 mysql_Linux centos7环境下安装MySQL的步骤详解

    Linux centos7环境下安装MySQL的步骤详解 安装MySQL mysql 有两个跟windows不同的地方 1).my.ini 保存到/etc/my.ini 2).用户权限,单独用户执行 ...

  4. linux mysql安装_Linux下安装mysql服务(超详细)

    Mysql数据库的安装对于开发者来说,是我们必然会面对的问题,它的安装过程其实并不复杂,并且网络上的安装教程也非常多,但是对于新手来说,各种不同形式的安装教程,又给新手们带来了要选择哪种方式进行安装的 ...

  5. 桂电在linux、Mac OS环境下使用出校器(支持2.14)

    这是guetsec学长在三院科协学长所抓包逆向分析1.81版出校器的基础上,用python写的一款为Mac和linux环境开发的出校器. 最后我做了略微修改,支持暂时最新版本2.14.下面有直接从源码 ...

  6. mysql数据库报错1075_MySQL数据库之在MAC OS X上安装MYSQL

    本文主要向大家介绍了MySQL数据库之在MAC OS X上安装MYSQL ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助. 我在网上找到了一篇文章,简直堪称神器. 刚开始用brew ...

  7. window环境下安装mysql(超级详细--婷姐教的)

    window环境下安装mysql 一.卸载 1.软件的卸载 ①通过控制面板 ②通过电脑管家等软件卸载 ③通过安装包中提供的卸载功能卸载 2.清理残余文件 ①清除安装残余文件 ②清除数据残余文件 ③清理 ...

  8. Centos无网环境下安装mysql步骤

    背景: 平时工作中会经常遇到没有外网的情况下安装mysql等软件的情况,由网络的话安装 MySQL 一直都是 使用 yum 命令一键搞定的,手动安装的话还是有些麻烦的. 需求就不用讲了,客户现场,政府 ...

  9. deepin下安装mysql_deepin linux 下安装mysql服务

    一.背景 之前一直用的是Windows作为开发环境,这一次使用linux,安装了linux的deepin分支.(deepin是国内做的最好的linux分支),具有linux环境与windows日常软件 ...

最新文章

  1. CGContextRef学习笔记
  2. 【项目实战课】AI零基础,人人免费可学!基于Pytorch的SimpleNet人脸表情识别实战...
  3. 【CentOS】如何在线安装pcre?
  4. crontab命令---Linux学习笔记
  5. rtmp协议分析(三次握手)
  6. android 应用升级sdk版本号,Bugly Android 应用升级 SDK 常见问题
  7. Android9.0 setMasterVolume流程分析(二十三)
  8. linux 文件目录对比,文件/目录对比:diff命令
  9. 盘点五款好用的项目管理软件
  10. vue运用JsBarcode生成一维码
  11. stm32 c语言 位带,我对STM32所用位带操作宏的超详细剖析、优势分析及应用推广探索研究(持续更新,欢迎讨论交流)...
  12. PDF文件拆分为图片
  13. salt returner mysql_saltstack mysql returner
  14. macOS 原生系统压缩文件在 Windows 上解压可能会乱码的原因及解决办法
  15. 干货 | Elasticsearch Nested类型深入详解
  16. 经典例题:判断给定数组是否已经排好序
  17. Android一点 play商店地区与语言设置
  18. 优秀课程案例:使用Scratch图形化编程工具模拟物理机械运动-连杆
  19. ise17.4 版本的安装
  20. 将图片转为base64,这样就不用找地方保存图片了,有时根本没有地方保存图片

热门文章

  1. 根据各工序时间画aoe网_曲靖被动防护网RXI150被动网厂家
  2. 如何使用数据库SCHEDULER来执行清归档脚本
  3. 向量空间和计算机科学与技术,向量空间
  4. 插入顶部_声屏障顶部斜插式安装可获得10-25dB的降噪量
  5. android后台如何动态添加图片,android – 如何从JSON数组动态地向ImageView添加图像...
  6. python redis事务_python redis事务源码及应用分析
  7. php链接页面时加..,怎么给一个PHP密码访问页面加超链接
  8. 高斯坐标正反算c语言,高斯投影坐标正反算编程报告
  9. python之sys模块详解_(转)python之os,sys模块详解
  10. Harbor仓库的管理