<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LiangXu Wang &#187; mysql</title>
	<atom:link href="http://wlx.westgis.ac.cn/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://wlx.westgis.ac.cn</link>
	<description>technology backup/share</description>
	<lastBuildDate>Sat, 14 Jan 2012 03:56:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ubuntu hardy下简易的proftpd+mysql配置</title>
		<link>http://wlx.westgis.ac.cn/501/</link>
		<comments>http://wlx.westgis.ac.cn/501/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 03:50:50 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[hardy]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[proftpd]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/?p=501</guid>
		<description><![CDATA[1. 安装 sudo aptitude install proftpd proftpd-mysql 2. 配置 /etc/proftpd/proftpd.conf 把 Include /etc/proftpd/sql.conf 前面的注释去掉 然后修改/etc/proftpd/sql.conf，我的相关配置如下： SQLBackend mysql SQLEngine on SQLAuthenticate on SQLAuthTypes Plaintext Crypt SQLConnectInfo ftp@localhost proftp abcde SQLUserInfo ftpuser userid passwd uid gid homedir shell SQLGroupInfo ftpgroup groupname gid &#8230; <a href="http://wlx.westgis.ac.cn/501/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>1. 安装</p>
<blockquote><p>sudo aptitude install proftpd proftpd-mysql</p></blockquote>
<p>2. 配置<br />
/etc/proftpd/proftpd.conf<br />
把</p>
<blockquote><p>Include /etc/proftpd/sql.conf
</p></blockquote>
<p>前面的注释去掉<br />
然后修改/etc/proftpd/sql.conf，我的相关配置如下：</p>
<blockquote><p>
SQLBackend	mysql<br />
SQLEngine on<br />
SQLAuthenticate on<br />
SQLAuthTypes Plaintext Crypt<br />
SQLConnectInfo ftp@localhost proftp abcde<br />
SQLUserInfo ftpuser userid passwd uid gid homedir shell<br />
SQLGroupInfo ftpgroup groupname gid members
</p></blockquote>
<p>3. 创建mysql库<br />
此处请参照<a href="http://www.howtoforge.com/virtual-hosting-with-proftpd-and-mysql-ubuntu-8.04">Virtual Hosting With Proftpd And MySQL (Incl. Quota) On Ubuntu 8.04 LTS</a></p>
<p>4. restart proftpd</p>
<blockquote><p>sudo /etc/init.d/proftpd restart</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/501/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>设置proftpd+mysql的虚拟FTP服务</title>
		<link>http://wlx.westgis.ac.cn/480/</link>
		<comments>http://wlx.westgis.ac.cn/480/#comments</comments>
		<pubDate>Sat, 15 Dec 2007 09:43:21 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[proftpd]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/480/</guid>
		<description><![CDATA[具体设置参考：http://www.howtoforge.com/proftpd_mysql_virtual_hosting 按照上面的设置完成后，还需要的操作： 1、允许恢复上传 在proftpd.conf里添加一行： AllowStoreRestart on 2、权限控制 比如，控制只读，可以在文件权限上设置，把写权限去掉，也可以在FTP权限里进行控制。 在FTP里进行权限控制，在相应目录下创建一个.ftpaccess文件，里面内容为： &#60;limit STOR&#62;DENYALL&#60;/limit&#62; 而专门供上传的目录，需要控制为不可删除： &#60;limit DELE&#62;DENYALL&#60;/limit&#62;]]></description>
			<content:encoded><![CDATA[<p>具体设置参考：http://www.howtoforge.com/proftpd_mysql_virtual_hosting</p>
<p>按照上面的设置完成后，还需要的操作：<br />
1、允许恢复上传<br />
在proftpd.conf里添加一行：</p>
<blockquote><p>AllowStoreRestart on</p></blockquote>
<p>2、权限控制<br />
比如，控制只读，可以在文件权限上设置，把写权限去掉，也可以在FTP权限里进行控制。<br />
在FTP里进行权限控制，在相应目录下创建一个.ftpaccess文件，里面内容为：</p>
<blockquote><p><code>&lt;limit STOR&gt;DENYALL&lt;/limit&gt;</code></p></blockquote>
<p>而专门供上传的目录，需要控制为不可删除：</p>
<blockquote><p><code>&lt;limit DELE&gt;DENYALL&lt;/limit&gt;</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/480/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql又出问题了</title>
		<link>http://wlx.westgis.ac.cn/477/</link>
		<comments>http://wlx.westgis.ac.cn/477/#comments</comments>
		<pubDate>Sat, 01 Dec 2007 14:44:16 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqladmin]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/477/</guid>
		<description><![CDATA[已经被MYSQL的问题烦恼了很长的时间了，而且一直没有搞清楚问题的原因。 原来已经调整了参数，并且设置了MYSQL每天自动重新启动一次，没想到还是有问题。 最近又出现了too many connections的问题，干脆再次调整参数，从500直接调整到1500了， 2.4 Too many connections错误 如果在你试土连接MySQL时，你得到错误Too many connections，这意味着已经有max_connections个客户连接了mysqld服务器。 如果你需要比缺省(100)更多的连接，那么你应该重启mysqld，用更大的 max_connections 变量值。 注意，mysqld实际上允许(max_connections+1)个客户连接。最后一个连接是为一个用Process权限的用户保留的。通过不把这个权限给一般用户(他们不应该需要它)，有这个权限一个管理员可以登录并且使用SHOW PROCESSLIST找出什么可能出错。见7.21 SHOW句法(得到表，列的信息）。 几个相关命令： mysqladmin version mysqladmin variable show processlist 完整信息可以参考：http://phpchina.com/bbs/archiver/tid-3817.html]]></description>
			<content:encoded><![CDATA[<p>已经被MYSQL的问题烦恼了很长的时间了，而且一直没有搞清楚问题的原因。<br />
原来已经调整了参数，并且设置了MYSQL每天自动重新启动一次，没想到还是有问题。<br />
最近又出现了too many connections的问题，干脆再次调整参数，从500直接调整到1500了，</p>
<blockquote><p>2.4 Too many connections错误<br />
如果在你试土连接MySQL时，你得到错误Too many connections，这意味着已经有max_connections个客户连接了mysqld服务器。</p>
<p>如果你需要比缺省(100)更多的连接，那么你应该重启mysqld，用更大的 max_connections 变量值。</p>
<p>注意，mysqld实际上允许(max_connections+1)个客户连接。最后一个连接是为一个用Process权限的用户保留的。通过不把这个权限给一般用户(他们不应该需要它)，有这个权限一个管理员可以登录并且使用SHOW PROCESSLIST找出什么可能出错。见7.21 SHOW句法(得到表，列的信息）。</p></blockquote>
<p>几个相关命令：<br />
mysqladmin version<br />
mysqladmin variable<br />
show processlist<br />
完整信息可以参考：http://phpchina.com/bbs/archiver/tid-3817.html</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/477/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>wordpress mu 1.3中的编码问题</title>
		<link>http://wlx.westgis.ac.cn/451/</link>
		<comments>http://wlx.westgis.ac.cn/451/#comments</comments>
		<pubDate>Sat, 03 Nov 2007 05:53:18 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[mu]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[utf8]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/451/</guid>
		<description><![CDATA[发现wordpress mu 升级到1.3版本了，对应到wordpress 2.3系列。其中，显著的功能就是默认的TAG支持了。但是升级后发现中文乱码，这时因为我的mysql数据库目前默认的编码还是latin1，而wordpress mu目前默认的编码是采用utf8了，因此需要进行修改。 有两种办法处理： 1、修改wordpress mu的代码 找到wp-inlcudes/wp-db.php文件，注释掉这两行： // if ( !empty($this-&#62;charset) &#38;&#38; version_compare(mysql_get_server_info(), '4.1.0', '&#62;=') ) // $this-&#62;query("SET NAMES '$this-&#62;charset'"); 2、修改数据库编码，使其和你的wordpress编码相对应 比如，可以修改数据库的编码为utf8。 首先导出： mysqldump --default-character-set=latin1 -uroot yourdb &#62; yourdb.sql 然后修改此文件，替换所有的latin1为utf8，并在文件头添加： SET NAMES utf8; SET CHARACTER_SET_CLIENT=utf8; SET CHARACTER_SET_RESULTS=utf8; 然后保存为yourdb-utf.sql，在进行数据库的导入工作： &#8230; <a href="http://wlx.westgis.ac.cn/451/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>发现wordpress mu 升级到1.3版本了，对应到wordpress 2.3系列。其中，显著的功能就是默认的TAG支持了。但是升级后发现中文乱码，这时因为我的mysql数据库目前默认的编码还是latin1，而wordpress mu目前默认的编码是采用utf8了，因此需要进行修改。</p>
<p>有两种办法处理：<br />
1、修改wordpress mu的代码<br />
找到wp-inlcudes/wp-db.php文件，注释掉这两行：</p>
<blockquote><p>
<code>//                if ( !empty($this-&gt;charset) &amp;&amp; version_compare(mysql_get_server_info(), '4.1.0', '&gt;=') )<br />
//                        $this-&gt;query("SET NAMES '$this-&gt;charset'");</code>
</p></blockquote>
<p>2、修改数据库编码，使其和你的wordpress编码相对应<br />
比如，可以修改数据库的编码为utf8。<br />
首先导出：</p>
<blockquote><p><code>mysqldump --default-character-set=latin1 -uroot yourdb &gt; yourdb.sql</code></p></blockquote>
<p>然后修改此文件，替换所有的latin1为utf8，并在文件头添加：</p>
<blockquote><p>    SET NAMES utf8;<br />
    SET CHARACTER_SET_CLIENT=utf8;<br />
    SET CHARACTER_SET_RESULTS=utf8; </p></blockquote>
<p>然后保存为yourdb-utf.sql，在进行数据库的导入工作：</p>
<blockquote><p><code>mysql -uroot<br />
mysql&gt;drop database yourdb<br />
mysql &gt;create database yourdb<br />
mysql -uroot yourdb&lt;yourdb-utf.sql</code></p></blockquote>
<p>此处的转换方法参考：<a href="http://wlx.westgis.ac.cn/378/">转换论坛：webwiz 7.9 -> phpBB3</a>。</p>
<p>我为了以后升级的方便，选择了第二种方法进行处理。</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/451/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>检测mysql进程并重启服务</title>
		<link>http://wlx.westgis.ac.cn/430/</link>
		<comments>http://wlx.westgis.ac.cn/430/#comments</comments>
		<pubDate>Sat, 22 Sep 2007 05:59:47 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[restart]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/430/</guid>
		<description><![CDATA[服务器上的mysql老是拖累apache，导致WWW服务不正常，前面修改过对应的mysql参数，但还是不行，因此，就决定设定让系统CRON下面这个脚本，注意脚本来自傅翮鹤 ，我仅仅修改了ubuntu下对应的参数而已。 #!/bin/bash #check apache,mysql thread and auto reboot service #Powered by 傅翮鹤 [www.fuhehe.com] #Date 2007-06-15 #config MaxApacheThread=100 MaxMysqlThread=50 HttpService=`ls /etc/init.d&#124;grep apache2` MysqlService=`ls /etc/init.d&#124;grep mysql` ApacheThread=`ps -A&#124;grep apache2&#124;wc -l` MysqlThread=`ps -A&#124;grep mysql&#124;wc -l` NeedReboot=0 if [ $ApacheThread -gt $MaxApacheThread ] &#8230; <a href="http://wlx.westgis.ac.cn/430/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>服务器上的mysql老是拖累apache，导致WWW服务不正常，前面修改过对应的mysql参数，但还是不行，因此，就决定设定让系统CRON下面这个脚本，注意脚本来自<a href="http://www.fuhehe.com">傅翮鹤 </a>，我仅仅修改了ubuntu下对应的参数而已。</p>
<blockquote><p><code>#!/bin/bash<br />
#check apache,mysql thread and auto reboot service<br />
#Powered by 傅翮鹤 [www.fuhehe.com]<br />
#Date 2007-06-15</p>
<p>#config<br />
MaxApacheThread=100<br />
MaxMysqlThread=50<br />
HttpService=`ls /etc/init.d|grep apache2`<br />
MysqlService=`ls /etc/init.d|grep mysql`</p>
<p>ApacheThread=`ps -A|grep apache2|wc -l`<br />
MysqlThread=`ps -A|grep mysql|wc -l`</p>
<p>NeedReboot=0</p>
<p>if [ $ApacheThread -gt $MaxApacheThread ]<br />
then<br />
NeedReboot=1<br />
fi<br />
if [ $ApacheThread -eq 0 ]<br />
then<br />
NeedReboot=2<br />
fi</p>
<p>if [ $MysqlThread -gt $MaxMysqlThread ]<br />
then<br />
NeedReboot=3<br />
fi<br />
if [ $MysqlThread -eq 0 ]<br />
then<br />
NeedReboot=4<br />
fi</p>
<p>if [ $NeedReboot -eq 1 ]<br />
then<br />
echo "-----------------------------"<br />
echo $(date +"%y-%m-%d %H:%M:%S")<br />
echo "-----------------------------"<br />
echo "Apache:$ApacheThread;Mysql:$MysqlThread."<br />
echo "Apache is busy,reboot"<br />
/etc/init.d/$HttpService stop<br />
/etc/init.d/$HttpService start<br />
elif [ $NeedReboot -eq 2 ]<br />
then<br />
echo "-----------------------------"<br />
echo $(date +"%y-%m-%d %H:%M:%S")<br />
echo "-----------------------------"<br />
echo "Apache:$ApacheThread;Mysql:$MysqlThread."<br />
echo "Apache is down,reboot"<br />
/etc/init.d/$HttpService start<br />
elif [ $NeedReboot -eq 3 ]<br />
then<br />
echo "-----------------------------"<br />
echo $(date +"%y-%m-%d %H:%M:%S")<br />
echo "-----------------------------"<br />
echo "Apache:$ApacheThread;Mysql:$MysqlThread."<br />
echo "Mysql is busy,reboot"<br />
/etc/init.d/$MysqlService stop<br />
/etc/init.d/$MysqlService start<br />
elif [ $NeedReboot -eq 4 ]<br />
then<br />
echo "-----------------------------"<br />
echo $(date +"%y-%m-%d %H:%M:%S")<br />
echo "-----------------------------"<br />
echo "Apache:$ApacheThread;Mysql:$MysqlThread."<br />
echo "Mysql is down,reboot"<br />
/etc/init.d/$MysqlService start<br />
else<br />
echo "-----------------------------"<br />
echo $(date +"%y-%m-%d %H:%M:%S")<br />
echo "-----------------------------"<br />
echo "Apache:$ApacheThread;Mysql:$MysqlThread."<br />
echo "System is normal"<br />
fi<br />
</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/430/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>整合phpbb3和svn服务</title>
		<link>http://wlx.westgis.ac.cn/416/</link>
		<comments>http://wlx.westgis.ac.cn/416/#comments</comments>
		<pubDate>Sun, 02 Sep 2007 05:12:19 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[phpbb]]></category>
		<category><![CDATA[westdc]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[phpbb3]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/416/</guid>
		<description><![CDATA[整合，题目有点大，呵呵。 其实就是把SVN的用户控制交给phpbb3来进行处理。 要求SVN必须采用apache2/mod_auth_mysql来进行控制的。 然后在phpbb3的后台创建一个新的用户组，用于控制可以访问SVN服务的用户。然后在mysql里创建一个视图，提取用户名称和密码。注意，PHPBB3采用的加密方式是直接MD5。假设创建的组名为svn： create view svnauth (username,passwd,groups) as select users.username,users.user_password,groups.group_name from groups,user_group left join users on user_group.user_id=users.user_id where groups.group_name=”svn” and user_group.group_id=groups.group_id ; 然后在apache2的site文件里设置为： Auth_MySQL_Encryption_Types PHP_MD5 这样就可以了，具体的操作还需要参考之前的文章：安装subversion: ssl+auth_mysql+mod_svn。 估计还需要mysql 5的支持，不知道mysql 4是否支持视图。]]></description>
			<content:encoded><![CDATA[<p>整合，题目有点大，呵呵。<br />
其实就是把SVN的用户控制交给phpbb3来进行处理。<br />
要求SVN必须采用apache2/mod_auth_mysql来进行控制的。<br />
然后在phpbb3的后台创建一个新的用户组，用于控制可以访问SVN服务的用户。然后在mysql里创建一个视图，提取用户名称和密码。注意，PHPBB3采用的加密方式是直接MD5。假设创建的组名为svn：</p>
<blockquote><p> create view svnauth (username,passwd,groups) as select users.username,users.user_password,groups.group_name from groups,user_group left join users on user_group.user_id=users.user_id where groups.group_name=”svn” and user_group.group_id=groups.group_id ;</p></blockquote>
<p>然后在apache2的site文件里设置为：</p>
<blockquote><p>Auth_MySQL_Encryption_Types PHP_MD5
</p></blockquote>
<p>这样就可以了，具体的操作还需要参考之前的文章：<a href="http://wlx.westgis.ac.cn/412">安装subversion: ssl+auth_mysql+mod_svn</a>。</p>
<p>估计还需要mysql 5的支持，不知道mysql  4是否支持视图。</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/416/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>apache2下使用mysql进行身份认证</title>
		<link>http://wlx.westgis.ac.cn/409/</link>
		<comments>http://wlx.westgis.ac.cn/409/#comments</comments>
		<pubDate>Tue, 14 Aug 2007 08:39:47 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[auth]]></category>
		<category><![CDATA[feisty]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/409/</guid>
		<description><![CDATA[服务器平台为ubuntu feisty，首先确认apache2已经安装好。 然后安装auth-mysql支持并启用此模块： sudo aptitude install libapache2-mod-auth-mysql sudo a2enmod auth_mysql 要建立一个数据库用于认证，并建立一个用户表存贮用户信息。 mysql -uroot create database svn; grant all on svn.* to svn@localhost identified by &#8216;mypwd&#8217;; flush privileges; use svn; create table auth( `username` varchar(25) NOT NULL default ”, `passwd` varchar(25) &#8230; <a href="http://wlx.westgis.ac.cn/409/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>服务器平台为ubuntu feisty，首先确认apache2已经安装好。<br />
然后安装auth-mysql支持并启用此模块：</p>
<blockquote><p>sudo aptitude install libapache2-mod-auth-mysql<br />
sudo a2enmod auth_mysql</p></blockquote>
<p>要建立一个数据库用于认证，并建立一个用户表存贮用户信息。</p>
<blockquote><p>mysql -uroot<br />
create database svn;<br />
grant all on svn.* to svn@localhost identified by &#8216;mypwd&#8217;;<br />
flush privileges;<br />
use  svn;<br />
create table auth(<br />
`username` varchar(25) NOT NULL default ”,<br />
`passwd` varchar(25) NOT NULL default ”,<br />
`groups` varchar(25) NOT NULL default ”,<br />
PRIMARY KEY (`username`),<br />
KEY `groups` (`groups`)<br />
) ENGINE=MyISAM DEFAULT CHARSET=latin1;</p></blockquote>
<p>然后修改site文件：</p>
<blockquote><p><code>Auth_MySQL_Info localhost &lt;auth_user&gt; &lt;password&gt;</p>
<p>&lt;Directory "&lt;web directory&gt;"&gt;<br />
Options +Indexes FollowSymLinks MultiViews<br />
AllowOverride AuthConfig Options FileInfo Limit<br />
Order allow,deny<br />
Allow from all<br />
&lt;/Directory&gt;</code></p></blockquote>
<p>创建.htaccess文件：</p>
<blockquote><p><code>AuthUserFile /dev/null<br />
AuthBasicAuthoritative off<br />
AuthMYSQL on<br />
AuthMySQL_Authoritative on<br />
AuthMySQL_DB svn<br />
AuthMySQL_Password_Table auth<br />
AuthMySQL_Group_Table auth<br />
AuthMySQL_Empty_Passwords off<br />
AuthMySQL_Encryption_Types Plaintext Crypt_DES<br />
AuthName "&lt;description&gt;"<br />
AuthType Basic</p>
<p>&lt;Limit GET POST&gt;<br />
require valid-user<br />
#or<br />
require group group group1<br />
&lt;/Limit&gt;</code></p></blockquote>
<p>注意问题:<br />
注意这个部分AuthUserFile /dev/null<br />
如果没有这行,apache的error_log中会出现这样的错误:</p>
<blockquote><p>[error] [client ip] (9)Bad file descriptor: Could not open password file: (null)</p></blockquote>
<p>如果没有AuthBasicAuthoritative off<br />
会出现错误:</p>
<blockquote><p>[error] [client ip] user yourusername not found:</p></blockquote>
<p>参考：</p>
<p>http://www.howtoforge.com/mod_auth_mysql_apache2_debian</p>
<p>http://www.linuxmine.com/79991.html</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/409/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>mysql: Too many connections</title>
		<link>http://wlx.westgis.ac.cn/402/</link>
		<comments>http://wlx.westgis.ac.cn/402/#comments</comments>
		<pubDate>Sun, 29 Jul 2007 09:42:12 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[connection]]></category>
		<category><![CDATA[cpu]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/402/</guid>
		<description><![CDATA[最近，服务器上经常出现MYSQL占用CPU100%的情况，导致和mysql有关的应用都死翘翘，估计和论坛有关系。 首先，修改了/etc/mysql/my.cnf，增大了并发数，把max_connections从100增大到500。 然后限制了论坛上的搜索设定，设定词频为40%，原来为90%。 还希望能限制搜索引擎的拜访次数，不过没有在phpbb3的后台里找到。 参考： http://dev.mysql.com/doc/refman/5.0/en/too-many-connections.html]]></description>
			<content:encoded><![CDATA[<p>最近，服务器上经常出现MYSQL占用CPU100%的情况，导致和mysql有关的应用都死翘翘，估计和论坛有关系。<br />
首先，修改了/etc/mysql/my.cnf，增大了并发数，把max_connections从100增大到500。<br />
然后限制了论坛上的搜索设定，设定词频为40%，原来为90%。<br />
还希望能限制搜索引擎的拜访次数，不过没有在phpbb3的后台里找到。</p>
<p>参考：</p>
<p>http://dev.mysql.com/doc/refman/5.0/en/too-many-connections.html</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/402/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>转移邮件服务器：postfix</title>
		<link>http://wlx.westgis.ac.cn/396/</link>
		<comments>http://wlx.westgis.ac.cn/396/#comments</comments>
		<pubDate>Tue, 03 Jul 2007 11:24:43 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[amavis]]></category>
		<category><![CDATA[clamav]]></category>
		<category><![CDATA[courier]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[feisty]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[saslauth]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/396/</guid>
		<description><![CDATA[原邮件服务器硬盘损害，已经无法工作，需要转移到新服务器上。 原来的服务器是debian etch，新服务器是ubuntu feisty。 首先安装： sudo aptitude install postfix postfix-mysql courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl postfix-tls libsasl2 libsasl2-modules libsasl2-modules-sql sasl2-bin openssl libpam-mysql amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 unzoo libnet-ph-perl libnet-snpp-perl libnet-telnet-perl nomarch lzop pax razor pyzor dcc-client &#8230; <a href="http://wlx.westgis.ac.cn/396/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>原邮件服务器硬盘损害，已经无法工作，需要转移到新服务器上。<br />
原来的服务器是debian etch，新服务器是ubuntu feisty。</p>
<p>首先安装：<br />
sudo aptitude install postfix postfix-mysql courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl postfix-tls libsasl2 libsasl2-modules libsasl2-modules-sql sasl2-bin openssl libpam-mysql  amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 unzoo libnet-ph-perl libnet-snpp-perl libnet-telnet-perl nomarch lzop pax razor pyzor dcc-client</p>
<p>首先创建mysql数据库，因为原来已经创建，直接导入就可以了。<br />
把原来的mysql-virtual*文件拷贝到/etc/postfix/目录下，注意若mysql用户密码发生变化，要进行相应的修改。<br />
然后修改文件权限：</p>
<blockquote><p>chmod o= /etc/postfix/mysql-virtual_*.cf<br />
chgrp postfix /etc/postfix/mysql-virtual_*.cf</p></blockquote>
<p>创建vmail用户：</p>
<blockquote><p>groupadd -g 5000 vmail<br />
useradd -g vmail -u 5000 vmail -d /home/vmail -m</p></blockquote>
<p>对/etc/postfix/main.cf进行修改定制：</p>
<blockquote><p>postconf -e &#8216;myhostname = server1.example.com&#8217;<br />
postconf -e &#8216;mydestination = server1.example.com, localhost, localhost.localdomain&#8217;<br />
postconf -e &#8216;mynetworks = 127.0.0.0/8&#8242;<br />
postconf -e &#8216;virtual_alias_domains =&#8217;<br />
postconf -e &#8216; virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf&#8217;<br />
postconf -e &#8216;virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf&#8217;<br />
postconf -e &#8216;virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf&#8217;<br />
postconf -e &#8216;virtual_mailbox_base = /home/vmail&#8217;<br />
postconf -e &#8216;virtual_uid_maps = static:5000&#8242;<br />
postconf -e &#8216;virtual_gid_maps = static:5000&#8242;<br />
postconf -e &#8216;smtpd_sasl_auth_enable = yes&#8217;<br />
postconf -e &#8216;broken_sasl_auth_clients = yes&#8217;<br />
postconf -e &#8216;smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination&#8217;<br />
postconf -e &#8216;transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf&#8217;<br />
postconf -e &#8216;content_filter = amavis:[127.0.0.1]:10024&#8242;<br />
postconf -e &#8216;receive_override_options = no_address_mappings&#8217;
</p></blockquote>
<p>这部分需要具体检查，我把myorigin这个给注释掉了，对于多域名的邮件列表有影响。</p>
<p>saslauthd相关设置，和DEBIAN不大一样，和UBUNTU EDGY也不尽相同：</p>
<blockquote><p>sudo rm -fdr /var/spool/postfix/var/run/saslauthd<br />
sudo mv /var/run/saslauthd /var/spool/postfix/var/run/saslauthd<br />
sudo ln -s /var/spool/postfix/var/run/saslauthd /var/run/saslauthd<br />
sudo adduser postfix sasl</p></blockquote>
<p>修改/etc/default/saslauthd文件，把START修改为yes。<br />
修改/etc/pam.d/smtp文件：</p>
<blockquote><p>auth    required   pam_mysql.so user=mail_admin passwd=mail_admin_password host=127.0.0.1 db=mail table=users usercolumn=email passwdcolumn=password crypt=1</p>
<p>account sufficient pam_mysql.so user=mail_admin passwd=mail_admin_password host=127.0.0.1 db=mail table=users usercolumn=email passwdcolumn=password crypt=1</p></blockquote>
<p>对应的用户名密码数据库要进行替换。</p>
<p>修改/etc/courier/authdaemonrc文件，把authmodulelist的值变为”authmysql”。</p>
<p>修改/etc/init.d/postfix文件，在FILES部分：</p>
<blockquote><p>     FILES=”etc/localtime etc/services etc/resolv.conf etc/hosts \<br />
    etc/nsswitch.conf etc/nss_mdns.config etc/postfix/sasl/smtpd.conf etc/sasldb2″ </p></blockquote>
<p>这个原来是有sasldb2文件的，但是在ubuntu feisty下没有这个文件，但执行起来没有问题，比较奇怪。</p>
<p>修改/etc/courier/authmysqlrc文件：</p>
<blockquote><p>MYSQL_SERVER localhost</p>
<p>MYSQL_USERNAME mail_admin</p>
<p>MYSQL_PASSWORD mail_admin_password</p>
<p>MYSQL_PORT 0</p>
<p>MYSQL_DATABASE mail</p>
<p>MYSQL_USER_TABLE users</p>
<p>MYSQL_CRYPT_PWFIELD password</p>
<p>#MYSQL_CLEAR_PWFIELD password</p>
<p>MYSQL_UID_FIELD 5000</p>
<p>MYSQL_GID_FIELD 5000</p>
<p>MYSQL_LOGIN_FIELD email</p>
<p>MYSQL_HOME_FIELD “/home/vmail”</p>
<p>MYSQL_MAILDIR_FIELD CONCAT(SUBSTRING_INDEX(email,&#8217;@',-1),&#8217;/',SUBSTRING_INDEX(email,&#8217;@',1),&#8217;/')
</p></blockquote>
<p>重新启动服务：</p>
<blockquote><p>/etc/init.d/courier-authdaemon restart<br />
/etc/init.d/courier-imap restart<br />
/etc/init.d/courier-imap-ssl restart<br />
/etc/init.d/courier-pop restart<br />
/etc/init.d/courier-pop-ssl restart<br />
/etc/init.d/postfix restart<br />
/etc/init.d/saslauthd restart</p></blockquote>
<p>修改/etc/aliases文件，可以根据自己的需要进行修改。</p>
<p>修改vi /etc/amavis/conf.d/15-content_filter_mode文件，去掉几个注释：</p>
<blockquote><p>use strict;</p>
<p># You can modify this file to re-enable SPAM checking through spamassassin</p>
<p># and to re-enable antivirus checking.</p>
<p>#</p>
<p># Default antivirus checking mode</p>
<p># Uncomment the two lines below to enable it back</p>
<p>#</p>
<p>@bypass_virus_checks_maps = (</p>
<p>   \%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);</p>
<p>#</p>
<p># Default SPAM checking mode</p>
<p># Uncomment the two lines below to enable it back</p>
<p>#</p>
<p>@bypass_spam_checks_maps = (</p>
<p>   \%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);</p>
<p>1;  # insure a defined return</p></blockquote>
<p>修改 /etc/amavis/conf.d/50-user文件，添加：</p>
<blockquote><p>$pax=&#8217;pax&#8217;;</p></blockquote>
<p>修改/etc/postfix/master.cf文件，添加：</p>
<blockquote><p>[...]</p>
<p>amavis unix &#8211; - &#8211; - 2 smtp</p>
<p>        -o smtp_data_done_timeout=1200</p>
<p>        -o smtp_send_xforward_command=yes</p>
<p>127.0.0.1:10025 inet n &#8211; - &#8211; - smtpd</p>
<p>        -o content_filter=</p>
<p>        -o local_recipient_maps=</p>
<p>        -o relay_recipient_maps=</p>
<p>        -o smtpd_restriction_classes=</p>
<p>        -o smtpd_client_restrictions=</p>
<p>        -o smtpd_helo_restrictions=</p>
<p>        -o smtpd_sender_restrictions=</p>
<p>        -o smtpd_recipient_restrictions=permit_mynetworks,reject</p>
<p>        -o mynetworks=127.0.0.0/8</p>
<p>        -o strict_rfc821_envelopes=yes</p>
<p>        -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks</p>
<p>        -o smtpd_bind_address=127.0.0.1</p></blockquote>
<p>修改/etc/spamassassin/local.cf，添加：</p>
<blockquote><p>[...]</p>
<p># dcc</p>
<p>use_dcc 1</p>
<p>dcc_path /usr/bin/dccproc</p>
<p>dcc_add_header 1</p>
<p>dcc_dccifd_path /usr/sbin/dccifd</p>
<p>#pyzor</p>
<p>use_pyzor 1</p>
<p>pyzor_path /usr/bin/pyzor</p>
<p>pyzor_add_header 1</p>
<p>#razor</p>
<p>use_razor2 1</p>
<p>razor_config /etc/razor/razor-agent.conf</p>
<p>#bayes</p>
<p>use_bayes 1</p>
<p>use_bayes_rules 1</p>
<p>bayes_auto_learn 1</p></blockquote>
<p>启动服务：</p>
<blockquote><p>adduser clamav amavis<br />
/etc/init.d/amavis restart<br />
/etc/init.d/clamav-daemon restart<br />
/etc/init.d/clamav-freshclam restart<br />
/etc/init.d/postfix restart
</p></blockquote>
<p>参考：</p>
<p>http://www.howtoforge.com/virtual_postfix_mysql_quota_courier_ubuntu_edgy</p>
<p>http://wlx.westgis.ac.cn/322/</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/396/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>转换论坛：webwiz 7.9 -&gt; phpBB3</title>
		<link>http://wlx.westgis.ac.cn/378/</link>
		<comments>http://wlx.westgis.ac.cn/378/#comments</comments>
		<pubDate>Sun, 03 Jun 2007 08:56:00 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[phpbb]]></category>
		<category><![CDATA[utf8]]></category>
		<category><![CDATA[webwiz]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/378/</guid>
		<description><![CDATA[webwiz是一个基于ASP的论坛，由于此官方论坛已经停止维护，官方网站很长时间无法登录了，由于ASP的先天缺陷，而且正好PHPBB3也已经到RC1了，就决定把这个论坛进行转换。 1、实际情况 我们使用的WEBWIZ 7.9使用的是ACCESS数据库，并且在使用过程中有一定的修改，但我不清楚有哪些修改，因此，你的转换若有问题，也请反馈你的实际情况。 头像有三种，一种是系统提供的，在avatars目录下，另一种是用户上传的头像，放在uploads目录下，还有一种是HTTP连接，就是放在另外网站上的头像。 WEBWIZ的附件是直接存放在uploads目录下，但数据库里没有任何相关信息。 WEBWIZ的密码是采用了HASHEncode+Salt的加密算法，和SHA1类似，但不同。 2、转换程序 phpBB3只提供了从phpbb2的升级程序，在phpbb的官方论坛上搜索到了一个从webwiz到phpbb2的转换程序，但其转换的内容不完整，因此就决定自己写一个。而且PHPBB3现在已经采用了UTF8编码，要求数据库也要采用UTF8编码，MYSQL 4.1之后的程序也提供了UTF8编码。 首先需要转换ACCESS数据库到MYSQL，我前面有介绍过如何进行转换。 我是使用了knoda进行数据转换的，在ubuntu系统下，注意，转换好后，数据库是默认为UTF8编码的。 转换完后，导出mysql数据。 mysqldump --default-character-set=latin1 -uroot yourdb &#62; yourdb.sql 要修改此SQL文件，使之成为UTF8编码。替换所有的latin1为utf8，并在文件的开始添加： SET NAMES utf8; SET CHARACTER_SET_CLIENT=utf8; SET CHARACTER_SET_RESULTS=utf8; 然后转移到测试服务器上，并进行相应的导入工作。 在http://www.phpbb.com下载最新的phpbb3，根据安装提示，安装一个默认的空白的PHPBB3系统，假如你的数据库是phpbb。 并把webwiz论坛的所有文件拷贝到同一个服务器上，二者目录可以在一个层次。 如： /var/www/phpbb /var/www/webwiz 然后把我提供的转换程序拷贝到phpbb/install/convertors目录下，即convert_webwiz.php和functions_webwiz.php文件。 同时修改phpbb/includes/auth/auth_db.php文件，若你想让你的用户重新申请密码的话，也可以不修改这个文件。 // Check password ... // &#8230; <a href="http://wlx.westgis.ac.cn/378/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>webwiz是一个基于ASP的论坛，由于此官方论坛已经停止维护，官方网站很长时间无法登录了，由于ASP的先天缺陷，而且正好PHPBB3也已经到RC1了，就决定把这个论坛进行转换。</p>
<p>1、实际情况<br />
我们使用的WEBWIZ 7.9使用的是ACCESS数据库，并且在使用过程中有一定的修改，但我不清楚有哪些修改，因此，你的转换若有问题，也请反馈你的实际情况。<br />
头像有三种，一种是系统提供的，在avatars目录下，另一种是用户上传的头像，放在uploads目录下，还有一种是HTTP连接，就是放在另外网站上的头像。<br />
WEBWIZ的附件是直接存放在uploads目录下，但数据库里没有任何相关信息。<br />
WEBWIZ的密码是采用了HASHEncode+Salt的加密算法，和SHA1类似，但不同。</p>
<p>2、转换程序<br />
phpBB3只提供了从phpbb2的升级程序，在phpbb的官方论坛上搜索到了一个从webwiz到phpbb2的转换程序，但其转换的内容不完整，因此就决定自己写一个。而且PHPBB3现在已经采用了UTF8编码，要求数据库也要采用UTF8编码，MYSQL 4.1之后的程序也提供了UTF8编码。<br />
首先需要转换ACCESS数据库到MYSQL，我前面有介绍过如何<a href="http://wlx.westgis.ac.cn/353/">进行转换</a>。<br />
我是使用了knoda进行数据转换的，在ubuntu系统下，注意，转换好后，数据库是默认为UTF8编码的。<br />
转换完后，导出mysql数据。</p>
<blockquote><p><code>mysqldump --default-character-set=latin1 -uroot yourdb &gt; yourdb.sql</code></p></blockquote>
<p>要修改此SQL文件，使之成为UTF8编码。替换所有的latin1为utf8，并在文件的开始添加：</p>
<blockquote><p>SET NAMES utf8;<br />
SET CHARACTER_SET_CLIENT=utf8;<br />
SET CHARACTER_SET_RESULTS=utf8;
</p></blockquote>
<p>然后转移到测试服务器上，并进行相应的导入工作。</p>
<p>在http://www.phpbb.com下载最新的phpbb3，根据安装提示，安装一个默认的空白的PHPBB3系统，假如你的数据库是phpbb。<br />
并把webwiz论坛的所有文件拷贝到同一个服务器上，二者目录可以在一个层次。<br />
如：</p>
<blockquote><p>
/var/www/phpbb<br />
/var/www/webwiz</p></blockquote>
<p>然后把我提供的转换程序拷贝到phpbb/install/convertors目录下，即convert_webwiz.php和functions_webwiz.php文件。<br />
同时修改phpbb/includes/auth/auth_db.php文件，若你想让你的用户重新申请密码的话，也可以不修改这个文件。</p>
<blockquote><p><code>	// Check password ...<br />
	// added for webwiz conversion<br />
	// HashEncode is webwiz function.<br />
	global $phpbb_root_path, $phpEx;<br />
	require($phpbb_root_path . 'includes/functions-webwiz-hash.' . $phpEx);<br />
	if (!$row['user_pass_convert'] &amp;&amp; (md5($password) == $row['user_password']<br />
		 or HashEncode($password.$row['salt'])==$row['user_password']))<br />
	{<br />
		if (md5($password)!=$row['user_password'])<br />
		{<br />
			// Unconverted password<br />
			$sql = 'UPDATE ' . USERS_TABLE . '<br />
				SET user_password = "'.md5($password).'"<br />
				WHERE user_id = ' . $row['user_id'];<br />
			$db-&gt;sql_query($sql);<br />
		}</p>
<p>		if ($row['user_login_attempts'] != 0)</code></p></blockquote>
<p>这个前面的$sql语句中要添加一个字段：salt。</p>
<p>若修改了此文件，还要拷贝functions-webwiz-hash.php到phpbb/includes/目录下。<br />
然后就可以在PHPBB的安装界面那儿进行系统的转换了。</p>
<p>下载：<a href='http://wlx.westgis.ac.cn/uploads/2007/06/webwiz.zip' title='webwiz 7.9 converter'>webwiz 7.9 converter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/378/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
	</channel>
</rss>

