这篇文章简述了在Mac OSX狮子(Lion)上安装MySQL Community Server最新版本v10.6.7的过程.

MySQL是最流行的开源数据库管理系统。首先,从MySQL的下载页面上下载适用于你机器环境的MySQL版本。比如,对于Mac
OSX狮子,可以下载64位版本的mysql-5.5.22-osx10.6-x86_64.dmg。MySQL的详细安装说明在MySQL参考手册(MySQL Reference Manual)的安装和升级(Installing and Upgrading)章。MySQL参考手册可以在MySQL文档页面上在线阅读或下载。

下面是针对mysql-5.5.22-osx10.6-x86_64.dmg的安装流程。下载这个文件后,双击装载(Mount)这个硬盘镜像. 如下图所示,这个镜像包含三个可安装项目。


第一项mysql-5.5.22-osx10.6-x86_64.pkg是MySQL应用程序本身。双击这个文件开始安装。安装的过程很直接,所以就不详述了。如果遇到问题,可以从ReadMe.txt文件中寻找答案

在安装完MySQL后,可以选择安装其它的两个项目。MySQL.prefPance在系统偏好设置(SystemPreferences)中创建一个MySQL项目(如图1所示)。用户可以通过它启动和停止MySQL服务器(如图2所示)。

如果你想让MySQL在系统启动时自动启动,就必须用第三个包MySQLStartupItem.pkg安装MySQL自动启动模块(MySQL Startup Item)双击MySQLStartupItem.pkg即开始安装。安装的过程很直接,如果遇到问题,可以从ReadMe.txt文件中寻找答案MySQL自动启动模块被装在/Library/StartupItems/MySQLCOM目录.
这个模块还在系统配置文件'/etc/hostconfig'中添加了一项'MySQLCOM=YES-' 。如果不想自动启动MySQL,可以将这一项设为NO,即'MySQLCOM=NO-'.
图1:在系统偏好设置中的MySQL项目

双击MySQL图标会打开MySQL控制面版.


图2:在系统偏好设置中启动/停止MySQL服务器

用MySQL启动项目(MySQL Startup Item)开始和停止MySQL服务器


除了可以在系统偏好设置中开始和停止MySQL服务器外,也可以用MySQL启动项目(MySQL Startup Item)做同样的操作。如果要启动MySQL服务器,可以用下面的命令。
shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
(可能需要输入密码)
停止MySQL服务器则用下面的命令。
shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
为用户'root'设置密码


MySQL缺省有一个用户'root'。MySQL安装后,用户'root'的密码为空。你可以用下面的命令设置'root'的密码。
shell> mysqladmin -u root password NEWPASSWORD
新密码设置完成后,你可以用下面的命令或phpAdmin登陆到MySQL。然后,你可以在MySQL的命令行环境中重运行MySQL的命令(例如 'show databases')以确认系统安装正确。
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 364
Server version: 5.1.62 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, 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 |
| test |
+--------------------+
3 rows in set (0.00 sec)

This articles describes how to install the latest version v5.5.22 of MySQL Community Server on Mac OSX Lion (v10.6.7).

MySQL is the most popular open source database management system. To install MySQL, first download the version that suits your enviroment
from MySQL's downloading page. For example, for my Mac OSX Lion laptop, I downloaded mysql-5.5.22-osx10.6-x86_64.dmg.
 MySQL's installation instructions can be found in the Installing and Upgrading chapter of MySQL's Reference Manual, which can be viewed online or downloaded on MySQL's
documentation page
.


Specifically, to install MySQL via mysql-5.5.22-osx10.6-x86_64.dmg, double-click to mount this disk image. As shown below, this disk image contains three installable items.


The first item, mysql-5.5.22-osx10.6-x86_64.pkg, is the MySQL application itself. Double-click this package file and then follow the instructions to install MySQL. It is a straightforward process. If you see any erros, please check ReadMe.txt for
special case handlings.

After installing MySQL, you can optionally install the other two items. MySQL.prefPance creates an entry in "System Preferences" so that you can start/stop MySQL service from "System Preferences" pane. To install, double-click MySQL.prefPane. If
the installation succeeds, you should see an entry in "System Preferences", as shown below.

MySQLStartupItem.pkg should be installed if you want MySQL to start automatically during system startup. Double-click this package file and follow the instructions. The installation process is also quite straightforward. Consult ReadMe.txt for
error handlings. The Startup Item is installed into /Library/StartupItems/MySQLCOM. It also adds an entry 'MySQLCOM=YES-' in the system configuration file '/etc/hostconfig'. To disable automatic startup, you can set 'MySQLCOM=NO-'.
Double-click MySQL icon will open the MySQL pane.


Start/Stop MySQL Server Using MySQL Startup Item


In addition to start/stop MySQL server from "System Preferences" pane, you can also start/stop it using MySQL Startup Item. To start the server, type the following command in a shell window.
shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
(ENTER PASSWORD, IF NECESSARY)
To stop the MySQL server, use the following command.
shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
Set the password for the user 'root'


By default, MySQL has a user 'root' with empty password. After installation completes, you can reset the password by running the following command
shell> mysqladmin -u root password NEWPASSWORD

After setting the password, log in to the MySQL server in the shell command or using phpAdmin

shell> mysql -u root --password=NEWPASSWORD test

If log in succeeds, you should see some outputs like below. You can run some sql commands (e.g., 'show databases') to verify MySQL is
working properly.

Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 364
Server version: 5.1.62 MySQL Community Server (GPL) Copyright (c) 2000, 2011, 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 |
| test |
+--------------------+
3 rows in set (0.00 sec)

在OSX狮子(Lion)上安装MYSQL(Install MySQL on Mac OSX)的更多相关文章

  1. 如何在一台服务器上安装两个mysql或者更多

    如何在一台服务器上安装两个mysql 1       前言 上篇写了在一台机器上源码编译安装一个mysql,那么如何在一台机器上源码编译安装两个mysql或者更多呢? 2       环境 mysql ...

  2. (转)如何在Windows上安装多个MySQL

    原文:http://www.blogjava.net/hongjunli/archive/2009/03/01/257216.html 如何在Windows上安装多个MySQL 本文以免安装版的mys ...

  3. 如何在一台机器上安装两个MYSQL数据库

    1.正常安装第一个mysql(安装步骤省略) 2.在控制面板里停止第一个mysql服务 3.将C:\Program Files\MySQL目录下的所有目录和文件copy到另外一个路径,我这里是copy ...

  4. 如何在Windows上安装多个MySQL

    将MySQL注册为系统服务:%MySQL_HOME%\bin>mysqld --install mysql5.1,此时,在运行中输入"services.msc"或者打开&qu ...

  5. (windows)一台电脑上安装两个Mysql服务

    原文:https://my.oschina.net/u/1472917/blog/410732 最近需要在一台电脑上安装两个Mysql服务,需求稍微有些奇怪,但确实很必要.本人原本为了本机测试Word ...

  6. Windows上安装多个MySQL实例(转)

    在学习和开发过程中有时候会用到多个MySQL数据库,比如Master-Slave集群.分库分表,开发阶段在一台机器上安装多个MySQL实例就显得方便不少. 在 MySQL教程-基础篇-1.1-Wind ...

  7. 在一台Linux服务器上安装多个MySQL实例(一)--使用mysqld_multi方式

    (一)MySQL多实例概述 实例是进程与内存的一个概述,所谓MySQL多实例,就是在服务器上启动多个相同的MySQL进程,运行在不同的端口(如3306,3307,3308),通过不同的端口对外提供服务 ...

  8. Install Ansible on Mac OSX

    from: https://devopsu.com/guides/ansible-mac-osx.html and : https://devopsu.com/guides/ansible-post- ...

  9. 使用Homebrew在Mountain Lion上安装MySQL

    一.安装mysql brew install mysql 二.开机启动mysql brew info mysql 根据提示,设置开机启动 三.设置mysql开启和停止命令 alias mysql-st ...

随机推荐

  1. VS2012 TFS切换账号登录

    最近要做团队项目,用到的vs2012的tfs代码管理器(win7 +vs2012),切换账号的流程如下: 1.打开控制面板,进入用户账户 2.点击左侧的管理您的凭据,看到自己的TFS服务器的地址,然后 ...

  2. VS2010 打包问题汇总

    问题1:打包时:应将msadox28.tlb排除 ,受到windows系统文件保护 解决方案:文件选项上,选择排除即可. 问题2:路径有文件,生成报错,提示找不到文件或文件被锁定. 解决方案:文件被锁 ...

  3. SQL 语句优化—— (一) 操作符优化

    1.IN 操作符 用IN写出来的SQL的优点是比较容易写及清晰易懂,这比较适合现代软件开发的风格.但是用IN的SQL性能总是比较低的,从Oracle执行的步骤来分析用IN的SQL与不用IN的SQL有以 ...

  4. oracle基础代码使用

    create or replace procedure pr_test1 is v_case ) :;--定义变量 begin -- /*判断语句 then dbms_output.put_line( ...

  5. 0. chromium源代码分析 - 序

    本打算在CSDN写完这系列文字,却因为在CSDN中误删了一篇blog,该篇blog被移到了回收站.然而CSDN居然没有从回收站撤销删除的操作方法.联想到之前CSDN泄密的问题,其可靠性值得怀疑.随转向 ...

  6. 解决jni链接时找不到函数的问题

    用jni调用库函数时,经常会碰到link的错误,具体出错信息如下: 08-07 01:42:06.490: E/AndroidRuntime(1665): java.lang.UnsatisfiedL ...

  7. C/C++中使用的正则表达式库

    正则表达式 正则表达式是对字符串操作的一种逻辑公式,就是用事先定义好的一些特定字符.及这些特定字符的组合,组成一个“规则字符串”,这个“规则字符串”用来表达对字符串的一种过滤逻辑. 正则引擎主要可以分 ...

  8. poj 1724 ROADS 最短路

    题目链接 n个节点, m条边, 一开始有K这么多的钱, 每条边有len, cost两个属性, 求1到n的最短距离, 花费要小于k. dis数组开成二维的, dis[u][cost]表示到达u花费为co ...

  9. MYSQL group_concat() 函数

    看来看一下表中的数据 select * from t; 下一步来看一下group_concat函数的用法 select ID,group_concat(Name) from t group by ID ...

  10. 文件保护DEP

    文件保护DEP数据执行保护(DEP)引起的电脑故障一例 症状:双击桌面上的“我的电脑”.“我的文档”等,explorer.exe重新起动,反复如此,简单说就是“我的电脑”打不开,一双击桌面上就啥都没有 ...