OSX狮子,可以下载64位版本的mysql-5.5.22-osx10.6-x86_64.dmg。MySQL的详细安装说明在MySQL参考手册(MySQL Reference Manual)的安装和升级(Installing and Upgrading)章。MySQL参考手册可以在MySQL文档页面上在线阅读或下载。
这个模块还在系统配置文件'/etc/hostconfig'中添加了一项'MySQLCOM=YES-' 。如果不想自动启动MySQL,可以将这一项设为NO,即'MySQLCOM=NO-'.
shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
(可能需要输入密码)
shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
shell> mysqladmin -u root password NEWPASSWORD
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)
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.
special case handlings.
the installation succeeds, you should see an entry in "System Preferences", as shown below.
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-'.
shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
(ENTER PASSWORD, IF NECESSARY)
shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
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)