mac ssh安装mysql_Mac下安装、启动MySQL

1.安装brew for mac包管理工具

2.brew install mysql

3.

先来了解一下mysql数据库默认的一些主要目录:

1、数据库目录 /var/lib/mysql/

2、配置文件  /usr/share/mysql(mysql.server命令及配置文件)

3、相关命令  /usr/bin (mysqladmin mysqldump等命令)

4、启动脚本  /etc/rc.d/init.d/(启动脚本文件mysql的目录)

安装后通过netstat –ano命令查看mysql默认端口3306是否存在,如果不存在,按下面的方法启动mysql服务。

启动mysql服务:

[root@localhostmysql]# pwd

/usr/share/mysql

[root@localhostmysql]# ./mysql.server start

StartingMySQL...[  确定  ]

[root@localhostmysql]# netstat -ano

ActiveInternet connections (servers and established)

ProtoRecv-Q Send-Q Local Address              Foreign Address            State       Timer

tcp        0     0 0.0.0.0:3306               0.0.0.0:*                   LISTEN      off (0.00/0/0)

[root@localhostmysql]# mysql

Welcometo the MySQL monitor.  Commands end with; or \g.

YourMySQL connection id is 1

Serverversion: 5.5.28 MySQL Community Server (GPL)

Copyright(c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle isa 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>

启动与停止

1、启动

MySQL安装完成后启动文件mysql在/etc/init.d目录下,在需要启动时运行下面命令即可。

[root@localhost mysql]#/etc/init.d/mysql start

2、停止

[root@localhost mysql] #/usr/bin/mysqladmin -u root -p shutdown

3、自动启动

1)察看mysql是否在自动启动列表中

[root@localhost mysql] #/sbin/chkconfig –list

2)把MySQL添加到你系统的启动服务组里面去

[root@localhost mysql] #/sbin/chkconfig – add mysql

3)把MySQL从启动服务组里面删除。

[root@localhost mysql] #/sbin/chkconfig – del mysql

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值