mysql官方下载地址:http://downloads.mysql.com

安装配置

1.下载后获得mysql-5.1.63.dmg安装包,双击打开,按下图依次打开

2.在系统偏好设置会多出mysql的按钮,点击后可以启动关闭mysql。如:

3.修改账户密码
​ /usr/local/mysql/bin/mysqladmin -u root password 新密码

安装配置完毕。

Mac下mysql的GUI图形界面

Mac下可以使用Sequel Pro来管理mysql数据库,Win下使用navicat。

默认3306端口。

使用终端管理的话:

启动mysql服务

1
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

停止mysql服务

1
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop

登录mysql

1
/usr/local/mysql/bin/mysql

Mac下修改mysql端口

1.在/usr/local/mysql/support-files/下找到my-medium.cnf文件复制到/usr/local/mysql重命名为my.cnf
2.修改my.cnf里面的port为你想要的端口口

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[client]

# password = your_password

port = 3307
socket = /tmp/mysql.sock

# Here follows entries for some specific programs

# The MySQL server

[mysqld]
port = 3307
socket = /tmp/mysql.sock
skip-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M