在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
Server version: 5.7. MySQL Community Server (GPL) Copyright (c) , , 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, rows affected, warning (0.00 sec) [mysql> FLUSH PRIVILEGES;
Query OK, 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 - GPL Copyright (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 - GPL Copyright (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” 节点登陆

在Mac OS环境下安装MySQL服务的更多相关文章

  1. Mac OS 环境下 安装 Asp.Net及使用Yeoman 创建Asp.Net 项目

    本文是按照英文原文:Installing ASP.NET 5 On Mac OS安装时遇到的问题的总结Blog. 原文提示如下: Installing ASP.NET 5 On Mac OS XBy ...

  2. Linux环境下安装mysql服务

    我使用的是阿里云的ECS服务,系统是CentOS7,安装mysql版本是5.7 第一步,通过 wget -i -c http://dev.mysql.com/get/mysql57-community ...

  3. Mac OS X 下安装MySQL 5.7

    下载安装包 官网下载安装包 选择相应的版本和格式,有 .dmg 和压缩包两种. 这里选择简单直接的 .dmg安装包,下载的时候可以将下载地址直接贴到迅雷,速度比较快. 安装 安装很简单,直接双击下好的 ...

  4. Mac OS X 下安装使用 Docker (2017年7月)

    两年前的一篇 Mac OS X 下安装使用 Docker 安装时还是用的 boot2docker, 如今进化到了在 Mac OS X 下用 Docker Toolbox, 而且命令也由 boot2do ...

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

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

  6. Linux centos7环境下安装MySQL的步骤详解

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

  7. 在Mac OS X下安装Android Studio

    在Mac OS X下安装Android Studio只需要几步. 1. 下载Android Studio安装包(.dmg). 2. 打开Terminal输入java -version命令查看是否已安装 ...

  8. Mac OS X 下安装使用 Docker

    它依赖于 LXC(Linux Container),能从网络上获得配置好的 Linux 镜像,非常容易在隔离的系统中运行自己的应用.也因为它的底层核心是个 LXC,所以在 Mac OS X 下需要在 ...

  9. 在MAC OS X下安装usb转串口驱动(PL2303主控芯片)

    本文原创于http://www.cnblogs.com/humaoxiao,非法转载者请自重!       因为最近手里有一块STM32Discovery开发板,所以想搞一下STM32的开发,我前面的 ...

随机推荐

  1. Linux 集锦(持续更新中)

    // 获取文件夹下的代码总行数 find . -name "*.*" | xargs wc -l // ls 排序 ls -lt 按照最后修改时间降序 ls -lrt 按照时间升序 ...

  2. Spring Security 学习总结

    Spring Security Spring Security是基于Spring提供声明式安全保护的安全性框架.Spring Security提供了完整的安全性解决方案,能够在Web请求级别和方法调用 ...

  3. linux不能上网问题

    第一种方法: 当linux不能上网,将网络配置成dhcp(注意:这里只能小写) onboot设置能yes 第二种方法: 第三种 window+r 快捷键 HKEY_LOCAL_MACHINE--> ...

  4. [Codeforces266E]More Queries to Array...——线段树

    题目链接: Codeforces266E 题目大意:给出一个序列$a$,要求完成$Q$次操作,操作分为两种:1.$l,r,x$,将$[l,r]$的数都变为$x$.2.$l,r,k$,求$\sum\li ...

  5. Codeforces1037F Maximum Reduction 【单调栈】

    题目分析: 没啥好说的,会单调栈就会做. 代码: #include<bits/stdc++.h> using namespace std; ; ; int n,k; int pre[max ...

  6. Codeforces518 D. Ilya and Escalator

    传送门:>Here< 题意:有n个人排队做电梯,每个人必须等前面的人全部上了以后才能上.对于每秒钟,有p的概率选择上电梯,(1-p)的概率选择不上电梯.现在问t秒期望多少人上电梯 解题思路 ...

  7. ☆ [POJ2411] Mondriaan's Dream 「状压DP」

    传送门 >Here< 题意:用1*2的砖块铺满n*m的地板有几种方案 思路分析 状压经典题! 我们以$f[i][j]$作为状态,表示第i行之前全部填完并且第i行状态为j(状压)时的方案数. ...

  8. Vijos P1459 车展 (treap 任意区间中位数)

    题面: 描述 遥控车是在是太漂亮了,韵韵的好朋友都想来参观,所以游乐园决定举办m次车展.车库里共有n辆车,从左到右依次编号为1,2,…,n,每辆车都有一个展台.刚开始每个展台都有一个唯一的高度h[i] ...

  9. windows 基础命令小集

    windows 基础命令小集 winver---------检查Windows版本wmimgmt.msc----打开windows管理体系结构(WMI)wupdmgr--------windows更新 ...

  10. 使用Putty执行Rsync命令

    背景介绍:公司的文件服务器有多个,一个Master服务器,10个左右的Slave服务器. 当Master服务器中的文件更新之后,Slave服务器中的文件也必须做相对应的同步操作. 公司目前使用的Rsy ...