<html>
<head>
<title>MySQL 5 绿色版</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
</head>
<body>
<h3 align="center">MySQL 5 绿色版(BAT版本)</h3>
<p align="center">By <a href="mailto:BeanSoft(beansoft@126.com">BeanSoft(beansoft@126.com</a>)
2007-02-04</p>
<p> 以前提供下载的那个 MySQL 5 绿色版是来自于 <a
href="http://www.dualface.com/blog/?p=231">Web 开发工具箱之 Apache PHP MySQL
绿色套装版</a>, 原作者是为了方便自己开发所做的一套整合了 Apache,
PHP, MySQL 的小工具箱, 但是没有源码. 类似的工具还有 <a
href="http://portableapps.com/apps/development/servers/xampp">XAMPP</a> - Apache, mySQL,
PHP, phpMyAdmin and more in an integrated package, 是做PHP开发的全套绿色工具.
为了做一套开源的 MySQL 5 绿色版, 完全控制启动停止, 我把 Mysql
绿色版用BAT文件重新包装了一遍.<br>
使用: 下载后解压缩到磁盘上的任意目录,
可以看到多出了一个 mysql5green 的目录. 打开这个目录,
有以下的几个文件:<br>
</p>
<table border="1" width="100%">
<tr>
<td width="50%"><strong>文件</strong></td>
<td width="50%"><strong>说明</strong></td>
</tr>
<tr>
<td width="50%">[bin] </td>
<td width="50%">MySQL 的二进制文件</td>
</tr>
<tr>
<td width="50%">[data]</td>
<td width="50%">MySQL 数据库文件</td>
</tr>
<tr>
<td width="50%">[share]</td>
<td width="50%">MySQL 英文资源文件</td>
</tr>
<tr>
<td width="50%">erase_log.bat</td>
<td width="50%">清空日志</td>
</tr>
<tr>
<td width="50%">mysql_start.bat</td>
<td width="50%">启动 MySQL,
双击后如果没有错误的话可以在系统进程中看到 mysqld-nt.exe,
并且可以通过 mysql 管理工具连接上, 端口 3306, 用户名 root, 密码为空</td>
</tr>
<tr>
<td width="50%">mysql_stop.bat</td>
<td width="50%">停止 MySQL</td>
</tr>
<tr>
<td width="50%">mysql绿色版.htm</td>
<td width="50%">介绍文件</td>
</tr>
<tr>
<td width="50%">tail.exe</td>
<td width="50%">Windows 版的tail</td>
</tr>
<tr>
<td width="50%">tail.zip</td>
<td width="50%">tail 的源码</td>
</tr>
<tr>
<td width="50%">view_log.bat</td>
<td width="50%">跟踪查看 MySQL 的工作日志, 包括所有查询的 SQL 语句</td>
</tr>
</table>
<p> 原理: 首先只保留了 MySQL
的最少运行文件来减少所占用的空间.
当然如果你愿意的话留下所有的 Mysql 5 文件也没有问题. 然后根据
mysqladmin.exe 和 mysqld-nt.exe 的命令行参数进行工作. mysqld-nt.exe --verbose
--help 可以看到所有能够使用的参数.</p>
<p>mysql_start.bat</p>
<table border="1" width="100%" bgcolor="#C0C0C0">
<tr>
<td width="100%">@echo off<br>
@echo Mysql startup ...<br>
start bin\mysqld-nt.exe --no-defaults --skip-bdb --skip-innodb --log=log.txt<br>
exit</td>
</tr>
</table>
<p>以不需要配置文件, 不支持bdb, innodb, 输出 SQL 查询日志文件到 data\log.txt
的方式来启动 Mysql.</p>
<p>mysql_stop.bat</p>
<table border="1" width="100%" bgcolor="#C0C0C0">
<tr>
<td width="100%">@echo off<br>
REM Mysql shutdown ...<br>
bin\mysqladmin --user=root --password= shutdown</td>
</tr>
</table>
<p>以 root 用户连接到 MySQL 执行 shutdown 命令.</p>
<p>view_log.bat</p>
<table border="1" width="100%" bgcolor="#C0C0C0">
<tr>
<td width="100%">@ECHO off <br>
cls <br>
color 0A<br>
@ECHO Opening Log file: data\log.txt<br>
tail -100f data\log.txt</td>
</tr>
</table>
<p>清屏, 设置绿色, 然后显示最新的100行数据并跟踪日志文件的内容.
这个窗口可以随时关闭, 不影响 MySQL 的执行.</p>
<p>一份 log 文件的示例输出:</p>
<table border="1" width="100%" bgcolor="#000000">
<tr>
<td width="100%"><strong><font color="#00FF00">Opening Log file: data\log.txt<br>
bin\mysqld-nt.exe, Version: 5.0.24a-community-nt-log. started with:<br>
TCP Port: 0, Named Pipe: (null)<br>
Time Id Command Argument<br>
70205 10:31:19 1 Connect root@localhost on<br>
1 Statistics<br>
1 Query SELECT VERSION()<br>
1 Query SHOW VARIABLES<br>
1 Query SHOW STATUS<br>
1 Query show databases<br>
1 Init DB information_schema<br>
1 Query show tables<br>
1 Init DB mysql<br>
1 Query show tables<br>
1 Init DB test<br>
1 Query show tables<br>
070205 10:31:20 1 Init DB test<br>
1 Query show tables</font></strong></td>
</tr>
</table>
<p>最后关于压缩, 发现压缩率 7Z > RAR > ZIP. 只有 7Z
能把这么多文件压缩到2MB以内, 其余两个都不行.</p>
</body>
</html>
- 1
- 2
- 3
- 4
- 5
- 6
前往页