<?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>自由自在 &#187; Mysql</title>
	<atom:link href="http://www.aease.org/category/lamp/mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://www.aease.org</link>
	<description>懦怯囚禁人的灵魂, 希望可以感受自由!</description>
	<lastBuildDate>Thu, 29 Jul 2010 08:00:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Mysql数据库备份方法</title>
		<link>http://www.aease.org/2010/04/mysql-database-backup-methods.html</link>
		<comments>http://www.aease.org/2010/04/mysql-database-backup-methods.html#comments</comments>
		<pubDate>Thu, 15 Apr 2010 03:43:45 +0000</pubDate>
		<dc:creator>wind</dc:creator>
				<category><![CDATA[Mysql]]></category>

		<guid isPermaLink="false">http://www.aease.org/2010/04/mysql-database-backup-methods.html</guid>
		<description><![CDATA[1. 拷贝表文件备份 对于使用其自己的文件存储引擎的表可以通过拷贝文件进行备份。如MyISAM表就是以文件保存，因此可以容易的拷贝文件备份(*.frm，*.MYD和*.MYI文件)。为了得到一个一致的备份，可以关闭数据库或者执行LOCK TABLES和FLUSH TABLES相关表． &#160; 2. 文本文件备份 创建包含表数据的文本文件． SELECT * INTO OUTFILE &#8216;file_name&#8217; FROM tbl_name 该方法适用任何类型的数据文件，但只保存表数据，不包含表结构．通过LOAD DATA INFILE或mysqlimport加载数据文件． &#160; 3. 通过mysqldump 或 mysqlhotcopy创建备份 mysqldump可以备份所有类型的表，而mysqlhotcopy仅支持一些存储引擎（MyISAM 和 ARCHIVE） shell&#62; mysqldump db_name &#62; dump_file shell&#62; mysqldump --tab=/path/to/some/dir db_name shell&#62; mysqlhotcopy db_name /path/to/some/dir 4. 启用二进制日志的增量备份 MySQL支持增量备份：须通过&#8211;log-bin选项启动数据库来启用二进制日志；当想要进行增量备份时(包含上一次完全备份或增量备份之后的所有更改)，应使用FLUSH LOGS回滚二进制日志。然后，你需要将从最后的完全或增量备份的某个时刻到最后某个点的所有二进制日志复制到备份位置。这些二进制日志为增量备份； &#160; 5. 使用复制从机创建备份 如果MySQL服务器为从复制服务器，则无论选择什么备份方法，当备份从机数据时，还应备份master.info和relay-log.info文件。恢复了从机数据后，需要这些文件来继续复制。如果从机执行复制LOAD DATA INFILE命令，你应还备份用&#8211;slave-load-tmpdir选项指定的目录中的SQL_LOAD-*文件。(如果未指定，该位置默认为tmpdir变量值）。从机需要这些文件来继续复制中断的LOAD DATA INFILE操作。 &#160; 6. 恢复损坏表 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>1. 拷贝表文件备份</strong></p>
<p>对于使用其自己的文件存储引擎的表可以通过拷贝文件进行备份。如MyISAM表就是以文件保存，因此可以容易的拷贝文件备份(*.frm，*.MYD和*.MYI文件)。为了得到一个一致的备份，可以关闭数据库或者执行LOCK TABLES和FLUSH TABLES相关表．</p>
<p>&#160;</p>
<p><strong>2. 文本文件备份</strong></p>
<p>创建包含表数据的文本文件．</p>
<blockquote><p>SELECT * INTO OUTFILE &#8216;file_name&#8217; FROM tbl_name</p>
</blockquote>
<p>该方法适用任何类型的数据文件，但只保存表数据，不包含表结构．通过LOAD DATA INFILE或mysqlimport加载数据文件．</p>
<p>&#160;</p>
<p><strong></strong></p>
<p> <span id="more-2890"></span>
<p><strong>3. 通过mysqldump 或 mysqlhotcopy创建备份</strong></p>
<p>mysqldump可以备份所有类型的表，而mysqlhotcopy仅支持一些存储引擎（<code>MyISAM</code> 和 <code>ARCHIVE</code>）</p>
<blockquote><p>shell&gt; <strong><code>mysqldump <em><code>db_name</code></em> &gt; <em><code>dump_file</code></em></code></strong>       <br />shell&gt; <strong><code>mysqldump --tab=<em><code>/path/to/some/dir</code></em> <em><code>db_name</code></em></code></strong></p>
<pre>shell&gt; <strong><code>mysqlhotcopy <em><code>db_name</code></em> <em><code>/path/to/some/dir</code></em></code></strong></pre>
</blockquote>
<p><strong>4. 启用二进制日志的增量备份</strong></p>
<p>MySQL支持增量备份：须通过&#8211;log-bin选项启动数据库来启用二进制日志；当想要进行增量备份时(包含上一次完全备份或增量备份之后的所有更改)，应使用FLUSH LOGS回滚二进制日志。然后，你需要将从最后的完全或增量备份的某个时刻到最后某个点的所有二进制日志复制到备份位置。这些二进制日志为增量备份；</p>
<p>&#160;</p>
<p><strong>5. 使用复制从机创建备份</strong></p>
<p>如果MySQL服务器为从复制服务器，则无论选择什么备份方法，当备份从机数据时，还应备份master.info和relay-log.info文件。恢复了从机数据后，需要这些文件来继续复制。如果从机执行复制LOAD DATA INFILE命令，你应还备份用&#8211;slave-load-tmpdir选项指定的目录中的SQL_LOAD-*文件。(如果未指定，该位置默认为tmpdir变量值）。从机需要这些文件来继续复制中断的LOAD DATA INFILE操作。</p>
<p>&#160;</p>
<p><strong>6. 恢复损坏表</strong></p>
<p>恢复MyISAM表，先使用REPAIR TABLE或<strong>myisamchk -r</strong>来恢复。99.9%的情况下该方法可以工作。如果<strong>myisamchk</strong>失败，试试下面的方法:</p>
<blockquote>
<p>1. 恢复原<strong>mysqldump</strong>备份，或二进制备份。</p>
<p>2. 执行下面的命令重新更新二进制日志：</p>
<p> shell&gt; <b>mysqlbinlog hostname-bin.[0-9]* | mysql</b></p>
</blockquote>
<p>&#160;</p>
<p><strong>7. 使用文件系统快照创建备份</strong></p>
<p>如果你正在使用Veritas的文件系统,可以这样备份:</p>
<blockquote>
<p>1. 从客户端程序执行FLUSH TABLES WITH READ LOCK。</p>
<p>2. 从另一个shell执行mount vxfs snapshot。</p>
<p>3. 从第一个客户端执行UNLOCK TABLES。</p>
<p>4. 从快照复制文件。</p>
<p>5. 卸载快照。</p>
</blockquote>
<p>类似的快照功能, 也可在其他文件系统使用, 如LVM或ZFS</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aease.org/2010/04/mysql-database-backup-methods.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL编译优化</title>
		<link>http://www.aease.org/2009/05/mysql-1.html</link>
		<comments>http://www.aease.org/2009/05/mysql-1.html#comments</comments>
		<pubDate>Fri, 15 May 2009 04:55:39 +0000</pubDate>
		<dc:creator>wind</dc:creator>
				<category><![CDATA[Mysql]]></category>

		<guid isPermaLink="false">http://192.168.100.15/blog/2009/05/mysql_1.html</guid>
		<description><![CDATA[1. -static 13%&#160; &#160;&#160; &#8211;with-client-ldflags=-all-static &#160;&#160; &#8211;with-mysqld-ldflags=-all-static 静态链接提高13%性能 2. -pgcc 1%&#160; &#160;&#160; CFLAGS=&#34;-O3 -mpentiumpro -mstack-align-double&#34; CXX=gcc &#160;&#160;&#160;&#160; CXXFLAGS=&#34;-O3 -mpentiumpro -mstack-align-double &#160;&#160;&#160;&#160; -felide-constructors -fno-exceptions -fno-rtti&#34; 如果是Inter处理器，使用pgcc提高1%性能 (使用Intel ICC compiler则相比标准GCC-compiler编译将使MYSQL数据库提升20%性能) 3. Unix Socket 7.5%&#160; &#160;&#160; &#8211;with-unix-socket-path=/path/mysql.sock 使用unix套接字链接提高7.5%性能，所以在windows下mysql性能肯定不如unix下面 4. &#8211;enable-assembler 允许使用汇编模式(优化性能)&#160; 详见下文: How Compiling and Linking Affects the Speed of MySQL Most of the following tests were performed [...]]]></description>
			<content:encoded><![CDATA[<p>1. -static 13%&#160; <br />&#160;&#160; &#8211;with-client-ldflags=-all-static     <br />&#160;&#160; &#8211;with-mysqld-ldflags=-all-static     <br />静态链接提高13%性能     <br />2. -pgcc 1%&#160; <br />&#160;&#160; CFLAGS=&quot;-O3 -mpentiumpro -mstack-align-double&quot; CXX=gcc      <br />&#160;&#160;&#160;&#160; CXXFLAGS=&quot;-O3 -mpentiumpro -mstack-align-double      <br />&#160;&#160;&#160;&#160; -felide-constructors -fno-exceptions -fno-rtti&quot;     <br />如果是Inter处理器，使用pgcc提高1%性能     <br />(使用<a href="http://www.intel.com/cd/software/products/asmo-na/eng/compilers/277618.htm" target="_blank">Intel ICC compiler</a>则相比标准GCC-compiler编译将使MYSQL数据库提升20%性能)     <br />3. Unix Socket 7.5%&#160; <br />&#160;&#160; &#8211;with-unix-socket-path=/path/mysql.sock    <br />使用unix套接字链接提高7.5%性能，所以在windows下mysql性能肯定不如unix下面     <br />4. &#8211;enable-assembler 允许使用汇编模式(优化性能)&#160; </p>
<p>详见下文:</p>
<blockquote><p><strong>How Compiling and Linking Affects the Speed of MySQL</strong></p>
<p>Most of the following tests were performed on Linux with the MySQL benchmarks, but they should give some indication for other operating systems and workloads.</p>
</blockquote>
<p><span id="more-247"></span></p>
<blockquote><p>You get the fastest executables when you link with <tt>-static</tt>.</p>
<p>On Linux, you will get the fastest code when compiling with <tt>pgcc</tt> and <tt>-O3</tt>. You need about 200MB memory to compile <tt>sql_yacc.cc</tt> with these options, because <tt>gcc/pgcc</tt> needs a lot of memory to make all functions inline. You should also set <tt>CXX=gcc</tt> when configuring MySQL to avoid inclusion of the <tt>libstdc++</tt> library, which is not needed. Note that with some versions of <tt>pgcc</tt>, the resulting code will run only on true Pentium processors, even if you use the compiler option indicating that you want the resulting code to work on all x586-type processors (such as AMD).</p>
<p>By just using a better compiler and better compiler options, you can get a 10-30% speed increase in your application. This is particularly important if you compile the MySQL server yourself.</p>
<p>We have tested both the Cygnus CodeFusion and Fujitsu compilers, but when we tested them, neither was sufficiently bug-free to allow MySQL to be compiled with optimizations enabled.</p>
<p>The standard MySQL binary distributions are compiled with support for all character sets. When you compile MySQL yourself, you should include support only for the character sets that you are going to use. This is controlled by the <tt>--with-charset</tt> option to <tt>configure</tt>.</p>
<p>Here is a list of some measurements that we have made:If y</p>
<ul>
<li>ou use <tt>pgcc</tt> and compile everything with <tt>-O6</tt>, the <tt>mysqld</tt> server is 1% faster than with <tt>gcc</tt> 2.95.2.</li>
<li>If you link dynamically (without <tt>-static</tt>), the result is 13% slower on Linux. Note that you still can use a dynamically linked MySQL library for your client applications. It is the server that is most critical for performance.</li>
<li>If you strip your <tt>mysqld</tt> binary with <tt>strip mysqld</tt>, the resulting binary can be up to 4% faster.</li>
<li>For a connection from a client to a server running on the same host, if you connect using TCP/IP rather than a Unix socket file, performance is 7.5% slower. (On Unix, if you connect to the hostname <tt>localhost</tt>, MySQL uses a socket file by default.)</li>
<li>For TCP/IP connections from a client to a server, connecting to a remote server on another host will be 8-11% slower than connecting to the local server on the same host, even for connections over 100Mb/s Ethernet.</li>
<li>When running our benchmark tests using secure connections (all data encrypted with internal SSL support) performance was 55% slower than for unencrypted connections.</li>
<li>If you compile with <tt>--with-debug=full</tt>, most queries will be 20% slower. Some queries may take substantially longer; for example, the MySQL benchmarks ran 35% slower. If you use <tt>--with-debug</tt> (without <tt>=full</tt>), the slowdown will be only 15%. For a version of <tt>mysqld</tt> that has been compiled with <tt>--with-debug=full</tt>, you can disable memory checking at runtime by starting it with the <tt>--skip-safemalloc</tt> option. The end result in this case should be close to that obtained when configuring with <tt>--with-debug</tt>.</li>
<li>On a Sun UltraSPARC-IIe, a server compiled with Forte 5.0 is 4% faster than one compiled with <tt>gcc</tt> 3.2.</li>
<li>On a Sun UltraSPARC-IIe, a server compiled with Forte 5.0 is 4% faster in 32-bit mode than in 64-bit mode.</li>
<li>Compiling with <tt>gcc</tt> 2.95.2 for UltraSPARC with the <tt>-mcpu=v8 -Wa,-xarch=v8plusa</tt> options gives 4% more performance.</li>
<li>On Solaris 2.5.1, MIT-pthreads is 8-12% slower than Solaris native threads on a single processor. With more load or CPUs, the difference should be larger.</li>
<li>Compiling on Linux-x86 using <tt>gcc</tt> without frame pointers (<tt>-fomit-frame-pointer</tt> or <tt>-fomit-frame-pointer -ffixed-ebp</tt>) makes <tt>mysqld</tt> 1-4% faster.</li>
</ul>
<p>Binary MySQL distributions for Linux that are provided by MySQL AB used to be compiled with <tt>pgcc</tt>. We had to go back to regular <tt>gcc</tt> due to a bug in <tt>pgcc</tt> that would generate code that does not run on AMD. We will continue using <tt>gcc</tt> until that bug is resolved. In the meantime, if you have a non-AMD machine, you can get a faster binary by compiling with <tt>pgcc</tt>. The standard MySQL Linux binary is linked statically to make it faster and more portable.</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.aease.org/2009/05/mysql-1.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MYSQL远程管理</title>
		<link>http://www.aease.org/2008/05/mysql.html</link>
		<comments>http://www.aease.org/2008/05/mysql.html#comments</comments>
		<pubDate>Fri, 09 May 2008 04:06:25 +0000</pubDate>
		<dc:creator>wind</dc:creator>
				<category><![CDATA[Mysql]]></category>

		<guid isPermaLink="false">http://192.168.100.15/blog/2008/05/mysql.html</guid>
		<description><![CDATA[1. 添加用户 安装Mysql后只有一个超级用户root,而root限制只能在数据库本机使用，需要添加一个可以远程访问的用户： mysql&#62;GRANT ALL PRIVILEGES ON *.* TO user@&#8217;%&#8217; identified by &#8216;password&#8217;; &#8216;%&#8217;表示可从任何机器访问，但该帐号无法进行本机登录，若进行本机登录，则执行： mysql&#62;GRANT ALL PRIVILEGES ON *.* TO user@localhost identified by &#8216;password&#8217;; 2. 防火墙设置 无防火墙可略过。 Linux：打开3306端口，使用iptables防火墙，编辑iptables配置文件增加-A RH-Firewall-1-INPUT -p tcp -m state &#8211;state NEW -m tcp &#8211;dport 3306 -j ACCEPT Windows: 允许mysqld-nt.exe程序的对外服务 3. 远程管理工具 工具很多，如EMS SQL Manager 2007 ,SQLyog, phpmyadmin&#8230;&#8230;]]></description>
			<content:encoded><![CDATA[<p>1. 添加用户</p>
<p><span class="mt-enclosure mt-enclosure-image"><img class="mt-image-right" style="FLOAT: right; MARGIN: 0pt 0pt 20px 20px" height="68" alt="firefox.png" src="http://www.mysql.com/common/logos/logo_mysql_sun.gif" width="205" /></span></p>
<p>安装Mysql后只有一个超级用户root,而root限制只能在数据库本机使用，需要添加一个可以远程访问的用户：</p>
<p>mysql&gt;<strong><span class="caps"><span class="caps">GRANT ALL PRIVILEGES</span></span> ON</strong> *<strong>.*</strong> <strong>TO</strong> <a href="mailto:user@'%'">user@&#8217;%&#8217;</a> <strong>identified by</strong> &#8216;password&#8217;;</p>
<p>&#8216;%&#8217;表示可从任何机器访问，但该帐号无法进行本机登录，若进行本机登录，则执行：</p>
<p>mysql&gt;<strong><span class="caps"><span class="caps">GRANT ALL PRIVILEGES</span></span> ON</strong> *<strong>.*</strong> <strong>TO</strong> <a href="mailto:user@localhost">user@localhost</a> <strong>identified by</strong> &#8216;password&#8217;;</p>
<p>2. 防火墙设置</p>
<p>无防火墙可略过。</p>
<p>Linux：打开3306端口，使用iptables防火墙，编辑iptables配置文件增加<br />-A RH-Firewall-1-INPUT -p tcp -m state &#8211;state <span class="caps"><span class="caps">NEW </span></span>-m tcp &#8211;dport 3306 -j <span class="caps"><span class="caps">ACCEPT</span></span></p>
<p>Windows: 允许mysqld-nt.exe程序的对外服务</p>
<p>3. 远程管理工具</p>
<p>工具很多，如EMS <span class="caps"><span class="caps">SQL</span></span> Manager 2007 ,SQLyog, phpmyadmin&#8230;&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aease.org/2008/05/mysql.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>基于RedHat Linux的Postfix邮件服务器安装(续)</title>
		<link>http://www.aease.org/2008/04/redhat-linuxpostfix-1.html</link>
		<comments>http://www.aease.org/2008/04/redhat-linuxpostfix-1.html#comments</comments>
		<pubDate>Mon, 21 Apr 2008 14:16:29 +0000</pubDate>
		<dc:creator>wind</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Postfix]]></category>

		<guid isPermaLink="false">http://192.168.100.15/blog/2008/04/redhat_linuxpostfix_1.html</guid>
		<description><![CDATA[基于Postfix的clamav、amavisd和SpamAssassin组件安装
]]></description>
			<content:encoded><![CDATA[<h3><strong>clamav、amavisd和SpamAssassin的安装</strong></h3>
<p>ClamAV是一个unix系统平台上的开源反病毒工具，它是特地为在邮件网关上进行邮件扫描而设计的。整套软件提供了许多的实用工具，包括一个可伸缩和可升级的多线程守护进程、一个命令行扫描工具和病毒库自动升级工具。</p>
<p>SpamAssassin 是目前最好的、最流行的开源反垃圾邮件软件之一。它是一个邮件过滤器，使用了多种反垃圾邮件技术，如：文本分析、贝叶斯过滤、DNS黑名单和分布式协同过滤数据库等。</p>
<p>amavisd-new是一个连接MTA和内容检测工具（诸如病毒扫描工具和SpamAssassin)的高性能接口程序，使用perl语言写成。它一般通过SMTP、ESMTP或者LMTP和MTA进行通讯，当然也可以借助于其它外部程序进行。同postfix（MTA）协同工作时表现尤佳。当它呼叫SpamAssassin进行内容过滤时，对于一封邮件只需要呼叫一次，而不管这封邮件将发往多少个收件人；同时，它亦会尽力保证实现每一位收件人的偏好设置，如接收/拒绝，检测/不检测，垃圾邮件级别等；它还会在邮件头部分插入spam相关信息。 </p>
<p><span id="more-76"></span></p>
<p><strong>一. 安装clamav-0.93</strong></p>
<p>最新的clamav-0.93需要zlib-1.2.2以上的版本的支持，而RHEL4上的版本为zlib-1.2.1，因此您需要先升级zlib</p>
<p>1、安装zlib-1.2.3</p>
<p>#tar zvxf zlib-1.2.3.tar.gz<br />#cd zlib-1.2.3<br />#./configure &#8211;prefix=/usr &#8211;shared<br />#make<br />#make test</p>
<p>2、安装clamav-0.93</p>
<p>添加ClamAV运行所需的组和用户：<br />#groupadd clamav<br />#useradd -g clamav -s /sbin/nologin -M clamav</p>
<p>添加配合amavisd-new使用的用户amavis<br />#groupadd amavis<br />#useradd -g amavis -s /sbin/nologin -M amavis</p>
<p>#tar zxvf clamav-0.93.tar.gz<br />#cd clamav-0.93<br />#./configure &#8211;prefix=/usr/local/clamav &#8211;with-dbdir=/usr/local/clamav/share &#8211;sysconfdir=/etc/clamav<br />#make<br />#make check<br />#make install</p>
<p>3、配置Clam AntiVirus：</p>
<p>编辑主配置文件：<br />#vi /etc/clamav/clamd.conf</p>
<p>注释掉第八行的Example,如下：<br /># Example</p>
<p>找到如下行<br />#LogFile /tmp/clamd.log<br />#PidFile /var/run/clamd.pid<br />LocalSocket /tmp/clamd.socket<br />#DatabaseDirectory /var/lib/clamav<br />#User clamav<br />修改为：<br />LogFile /var/log/clamav/clamd.log&nbsp;&nbsp;&nbsp; #启用日志<br />PidFile /var/run/clamav/clamd.pid&nbsp;&nbsp; #保存监听进程标志符<br />LocalSocket /var/run/clamav/clamd.socket&nbsp; <br />DatabaseDirectory /usr/local/clamav/share&nbsp;&nbsp;&nbsp; #数据库目录<br />User amavis</p>
<p>启用以下选项<br />LogSyslog yes<br />LogFacility LOG_MAIL<br />LogVerbose yes<br />StreamMaxLength 20M&nbsp; (后面的数值应该与邮件服务器允许的最大附件值相一致)</p>
<p>编辑更新进程的配置文件(病毒库更新)<br />#vi /etc/clamav/freshclam.conf</p>
<p>注释掉Example，如下:<br /># Example</p>
<p>找到如下行<br />#DatabaseDirectory /var/lib/clamav<br />#UpdateLogFile /var/log/freshclam.log<br />PidFile /var/run/freshclam.pid<br />分别修改为：<br />DatabaseDirectory /usr/local/clamav/share<br />UpdateLogFile /var/log/clamav/freshclam.log<br />PidFile /var/run/clamav/freshclam.pid</p>
<p>启用以下选项：<br />DatabaseMirror db.XY.clamav.net&nbsp; (这里也可以把XY改成您的国家代码来实现，比如，我们用cn来代替)<br />LogSyslog yes<br />LogFacility LOG_MAIL<br />LogVerbose yes</p>
<p>4、建立日志所在的目录、进程与socket所在的目录，并让它属于clamav用户：</p>
<p># mkdir -v /var/log/clamav<br /># chown -R amavis.amavis /var/log/clamav<br /># mkdir -v /var/run/clamav<br /># chmod 700 /var/run/clamav<br /># chown -R amavis.amavis /var/run/clamav</p>
<p>建立freshlog的日志文件<br />#touch&nbsp; /var/log/clamav/freshclam.log<br />#chown&nbsp; clamav.clamav&nbsp; /var/log/clamav/freshclam.log</p>
<p>5、配置crontab，让Clam AntiVirus每小时检测一次新的病毒库：</p>
<p># crontab -e<br />添加：<br />37 * * * * /usr/local/clamav/bin/freshclam</p>
<p>6、配置库文件搜索路径：</p>
<p># echo &#8220;/usr/local/clamav/lib&#8221; &gt;&gt; /etc/ls.so.conf<br /># ldconfig -v</p>
<p>7、配置clamav开机自动启动</p>
<p># cp contrib/init/RedHat/clamd&nbsp; /etc/rc.d/init.d/clamd<br /># cp contrib/init/RedHat/clamav-milter&nbsp; /etc/rc.d/init.d/clamav-milter<br /># chkconfig &#8211;add clamd<br /># chkconfig &#8211;add clamav-milter<br /># chkconfig &#8211;level 2345 clamd on<br /># chkconfig &#8211;level 2345 clamav-milter on</p>
<p>编辑/etc/rc.d/init.d/clamd，将服务进程的路径指向刚才的安装目录<br />#vi /etc/rc.d/init.d/clamd<br />找到如下行<br />progdir=&#8221;/usr/local/sbin&#8221;<br />修改为：<br />progdir=&#8221;/usr/local/clamav/sbin&#8221;</p>
<p>启动clamd<br />#service clamd start</p>
<p><strong>二. 安装Spamassassin-3.2.4</strong></p>
<p>1、依赖关系的解决，安装Spamassassin需要很多perl模块的支持，以下是所需模块列表及安装方法,各软件包都可从CPAN取得；</p>
<p>必须的软件包：<br />Digest::SHA1<br />HTML::Parser &gt;=3.43<br />Net::DNS &gt;= 0.34<br />LWP (aka libwww-perl)<br />HTTP::Date<br />IO::Zlib &gt;= 1.04<br />Archive::Tar&nbsp; &gt;=1.23</p>
<p>可选的软件包:<br />MIME::Base64<br />DB_File<br />Net::SMTP<br />Mail::SPF 或 Mail::SPF::Query<br />IP::Country::Fast<br />Net::Ident<br />IO::Socket::INET6<br />IO::Socket::SSL<br />Compress::Zlib<br />Time::HiRes<br />Mail::DKIM<br />Mail::DomainKeys<br />DBI *and* DBD driver/modules<br />Encode::Detect<br />Apache::Test<br />Razor2</p>
<p>推荐使用CPAN自动安装（你的主机要能连上Internet），它能够自动下载安装，并能解决安装过程中的依赖关系。您可以使用类同的以下的命令来进行安装:<br />#perl -MCPAN -e shell<br />cpan&gt; o conf prerequisites_policy ask<br />cpan&gt; install Digest::SHA1<br />&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;</p>
<p>如果您的主机无法直接连接到Internet，您也可以到<a href="http://search.cpan.org/" target="_blank">http://search.cpan.org/</a>上搜索下载所需要的软件包，而后使用类同的下列命令安装：</p>
<p>#tar zxvf 软件包.tar.gz<br />#cd 软件包<br />#perl Makefile.PL<br />#make<br />#make test<br />#make install<br />说明：某些软件包安装的过程中可能需要已经列出的其它软件包的支持（可以先尝试安装Spamassassin,然后按提示补充所需软件包），请安照提示自行调整安装顺序。另外，其中有个软件包安装过程中可能要求声明环境变量LC_ALL，此时，可输入如下命令，并重新进行软件包的编译安装即可。<br />#export LC_ALL=C</p>
<p>2、安装Spamassassin-3.2.4</p>
<p>#tar jxvf Mail-SpamAssassin-3.2.4.tar.bz2<br />#cd Mail-SpamAssassin-3.2.4<br />#perl Makefile.PL<br />#make<br />#make check<br />#make install</p>
<p>3、编辑主配置文件/etc/mail/spamassassin/local.cf</p>
<p>可以通过<a href="http://www.yrex.com/spam/spamconfig.php" target="_blank">这里(http://www.yrex.com/spam/spamconfig.php)</a>自动生成配置文件.</p>
<blockquote>
<p># SpamAssassin config file for version 3.x<br /># NOTE: NOT COMPATIBLE WITH VERSIONS 2.5 or 2.6<br /># See <a href="http://www.yrex.com/spam/spamconfig25.php">http://www.yrex.com/spam/spamconfig25.php</a> for earlier versions<br /># Generated by <a href="http://www.yrex.com/spam/spamconfig.php">http://www.yrex.com/spam/spamconfig.php</a> (version 1.50) </p>
<p># How many hits before a message is considered spam.<br />required_score&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10.0 </p>
<p># Change the subject of suspected spam<br />rewrite_header subject&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [垃圾邮件] </p>
<p># Encapsulate spam in an attachment (0=no, 1=yes, 2=safe)<br />report_safe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 </p>
<p># Enable the Bayes system<br />use_bayes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 </p>
<p># Enable Bayes auto-learning<br />bayes_auto_learn&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 </p>
<p># Enable or disable network checks<br />skip_rbl_checks&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br />use_razor2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br />use_pyzor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 </p>
<p># Mail using languages used in these country codes will not be marked<br /># as being possibly spam in a foreign language.<br />#ok_languages&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all </p>
<p># Mail using locales used in these country codes will not be marked<br /># as being possibly spam in a foreign language.<br />ok_locales&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all </p>
</blockquote>
<p>4、测试spamassassin</p>
<p>#spamassassin -t &lt; sample-nonspam.txt &gt; nonspam.out<br />#spamassassin -t &lt; sample-spam.txt &gt; spam.out</p>
<p>查看测试结果：</p>
<p>#less nonspam.out<br />#less spam.out</p>
<p>5、检查配置文件</p>
<p>#spamassassin -d &#8211;lint</p>
<p>6、启动进程，并将其加入到自动启动队列</p>
<p>#/usr/bin/spamd -d <br />#echo &#8220;/usr/bin/spamd -d&#8221; &gt;&gt; /etc/rc.local</p>
<p>7、增加中文反垃圾邮件支持</p>
<p>从网上取得规则表<br /># wget -N -P /usr/share/spamassassin <a href="http://www.ccert.edu.cn/spam/sa/Chinese_rules.cf">http://www.ccert.edu.cn/spam/sa/Chinese_rules.cf</a><br />将cf文件复制到/usr/share/spamassassin下<br />重启spamassassin</p>
<p><strong>三. 安装amavisd-new-2.5.4</strong></p>
<p>1、依赖关系的解决</p>
<p>以下为官方声明所必须的软件包列表，你可以采用类同安装Spamassassin一节中的perl模块的安装方法进行安装</p>
<p>Archive::Zip&nbsp;&nbsp; (Archive-Zip-x.xx) &gt;=1.14 <br />Compress::Zlib (Compress-Zlib-x.xx) &gt;=1.35<br />Convert::TNEF&nbsp; (Convert-TNEF-x.xx)<br />Convert::UUlib (Convert-UUlib-x.xxx) &gt;=1.08 <br />MIME::Base64&nbsp;&nbsp; (MIME-Base64-x.xx)<br />MIME::Parser&nbsp;&nbsp; (MIME-Tools-x.xxxx) <br />Mail::Internet (MailTools-1.58 or later have workarounds for Perl 5.8.0 bugs)<br />Net::Server&nbsp;&nbsp;&nbsp; (Net-Server-x.xx) (version 0.88 finally does setuid right)<br />Digest::MD5&nbsp;&nbsp;&nbsp; (Digest-MD5-x.xx) &gt;=2.22<br />IO::Stringy&nbsp;&nbsp;&nbsp; (IO-stringy-x.xxx)<br />Time::HiRes&nbsp;&nbsp;&nbsp; (Time-HiRes-x.xx) &gt;=1.49 <br />Unix::Syslog&nbsp;&nbsp; (Unix-Syslog-x.xxx)<br />BerkeleyDB&nbsp;&nbsp;&nbsp;&nbsp; with bdb library &gt;=3.2&nbsp;</p>
<p>2、安装amavisd-new-2.5.4</p>
<p>创建运行时目录，并赋予amavis用户（前文中所建）<br /># mkdir -pv /var/amavis/{tmp,var,db,home}<br /># chown -R amavis:amavis /var/amavis<br />#chmod -R 750 /var/amavis</p>
<p>#tar zxvf amavisd-new-2.5.4.tar.gz<br />#cd amavisd-new-2.5.4</p>
<p>拷贝服务端至$PATH中指定的目录，推荐拷贝至/usr/local/sbin：<br />#cp amavisd /usr/local/sbin/<br />#chown root /usr/local/sbin/amavisd<br />#chmod 755&nbsp; /usr/local/sbin/amavisd</p>
<p>拷贝主配置文件至/etc，并修改相应的权限：<br />#cp amavisd.conf /etc<br /># chown root:amavis /etc/amavisd.conf <br /># chmod 640 /etc/amavisd.conf</p>
<p>创建amavisd运行中所需要的隔离区域：<br /># mkdir -v /var/virusmails<br /># chown amavis:amavis /var/virusmails/<br /># chmod 750 /var/virusmails/</p>
<p>3、编辑主配置文件<br />#vi /etc/amavisd.conf</p>
<p>确保您的如下选项的值如下文所示：<br />$daemon_user&nbsp; = &#8216;amavis&#8217;;<br />$daemon_group = &#8216;amavis&#8217;; <br />$mydomain = &#8216;test.com&#8217;; (此处可更改为您集体的域)</p>
<p>$virus_admin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = &#8220;postmaster@$mydomain&#8221;;&nbsp; <br />$mailfrom_notify_admin&nbsp;&nbsp;&nbsp;&nbsp; = &#8220;postmaster@$mydomain&#8221;;&nbsp; <br />$mailfrom_notify_recip&nbsp;&nbsp;&nbsp;&nbsp; = &#8220;postmaster@$mydomain&#8221;;&nbsp; <br />$mailfrom_notify_spamadmin = &#8220;postmaster@$mydomain&#8221;; <br />$mailfrom_to_quarantine = &#8221;;</p>
<p>virus_admin_maps =&gt; ["postmaster@$mydomain"]&nbsp;&nbsp;&nbsp; (指定报告病毒和垃圾邮件时发送系统邮件的用户身份)<br />spam_admin_maps&nbsp; =&gt; ["postmaster@$mydomain"]</p>
<p>$sa_tag_level_deflt&nbsp; = 2.0;&nbsp; #此处可以设置垃圾邮件分值相关操作定义<br />$sa_tag2_level_deflt = 6.2;&nbsp; <br />$sa_kill_level_deflt = 6.9;&nbsp; <br />$sa_dsn_cutoff_level = 10;&nbsp;&nbsp;</p>
<p>启用ClamAV,(大概在第355行)去掉如下行前的注释符: <br />#['ClamAV-clamd',<br />#&nbsp;&nbsp;&nbsp;&nbsp; &amp;ask_daemon, ["CONTSCAN {}n", "/var/run/clamav/clamd"],<br />#&nbsp;&nbsp;&nbsp; qr/bOK$/, qr/bFOUND$/,<br />#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],<br />#&nbsp;&nbsp;&nbsp;&nbsp; ['Mail::ClamAV', &amp;ask_clamav, "*", [0], [1], qr/^INFECTED: (.+)/],</p>
<p>并将如上行中的/var/run/clamav/clamd修改为:/var/run/clamav/clamd.socket</p>
<blockquote>
<p><font style="FONT-SIZE: 1.25em" color="#ff0000" size="5">注意: 安装运行以来,发现原SA的配置文件中定义的分值没起做用,都以本配置文件为准,对此还需要进一步了解!!!</font></p>
</blockquote>
<p>4、测试启动</p>
<p>#/usr/local/sbin/amavisd</p>
<p>您也可以按如下命令调试启动<br />#/usr/local/sbin/amavisd debug</p>
<p>5、修改postfix的配置，让它能调用amavisd，以实现病毒及垃圾邮件的过滤</p>
<p>#vi /etc/postfix/master.cf<br />在文末添加如下内容：</p>
<p># ==========================================================================<br /># service type&nbsp; private unpriv&nbsp; chroot&nbsp; wakeup&nbsp; maxproc command + args<br />#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (yes)&nbsp;&nbsp; (yes)&nbsp;&nbsp; (yes)&nbsp;&nbsp; (never) (100)<br /># ==========================================================================<br />#<br />amavisfeed unix&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp; smtp<br />&nbsp;&nbsp;&nbsp; -o smtp_data_done_timeout=1200<br />&nbsp;&nbsp;&nbsp; -o smtp_send_xforward_command=yes<br />&nbsp;&nbsp;&nbsp; -o disable_dns_lookups=yes<br />&nbsp;&nbsp;&nbsp; -o max_use=20<br />#<br />127.0.0.1:10025 inet n&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp; smtpd<br />&nbsp;&nbsp;&nbsp; -o content_filter=<br />&nbsp;&nbsp;&nbsp; -o smtpd_delay_reject=no<br />&nbsp;&nbsp;&nbsp; -o smtpd_client_restrictions=permit_mynetworks,reject<br />&nbsp;&nbsp;&nbsp; -o smtpd_helo_restrictions=<br />&nbsp;&nbsp;&nbsp; -o smtpd_sender_restrictions=<br />&nbsp;&nbsp;&nbsp; -o smtpd_recipient_restrictions=permit_mynetworks,reject<br />&nbsp;&nbsp;&nbsp; -o smtpd_data_restrictions=reject_unauth_pipelining<br />&nbsp;&nbsp;&nbsp; -o smtpd_end_of_data_restrictions=<br />&nbsp;&nbsp;&nbsp; -o smtpd_restriction_classes=<br />&nbsp;&nbsp;&nbsp; -o mynetworks=127.0.0.0/8<br />&nbsp;&nbsp;&nbsp; -o smtpd_error_sleep_time=0<br />&nbsp;&nbsp;&nbsp; -o smtpd_soft_error_limit=1001<br />&nbsp;&nbsp;&nbsp; -o smtpd_hard_error_limit=1000<br />&nbsp;&nbsp;&nbsp; -o smtpd_client_connection_count_limit=0<br />&nbsp;&nbsp;&nbsp; -o smtpd_client_connection_rate_limit=0<br />&nbsp;&nbsp;&nbsp; -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters<br />&nbsp;&nbsp;&nbsp; -o local_header_rewrite_clients=</p>
<p>说明：注意每行&#8221;-o&#8221;前的空格；</p>
<p>#vi /etc/postifx/main.cf<br />在文末添加如下行：<br />content_filter=amavisfeed:[127.0.0.1]:10024</p>
<p>4、让postfix重新加载主配置文件，并查看启动情况</p>
<p># postfix reload &amp;&amp; tail -f /var/log/maillog</p>
<p>5、查看amavisd是否在监听10024端口，并测试服务启动情况：</p>
<p># telnet localhost 10024<br />Trying 127.0.0.1&#8230;<br />Connected to localhost.localdomain (127.0.0.1).<br />Escape character is &#8216;^]&#8217;.<br />220 [127.0.0.1] ESMTP amavisd-new service ready<br />EHLO localhost<br />250-[127.0.0.1]<br />250-VRFY<br />250-PIPELINING<br />250-SIZE<br />250-ENHANCEDSTATUSCODES<br />250-8BITMIME<br />250-DSN<br />250 XFORWARD NAME ADDR PROTO HELO<br />Quit&nbsp; <br />221 2.0.0 [127.0.0.1] amavisd-new closing transmission channel<br />Connection closed by foreign host.</p>
<p>6、postfix重新加载配置文件后将授权并激活&#8221;127.0.0.1:10025&#8243;端口，一个正常的服务连接应该类同下面所示：</p>
<p># telnet localhost 10025<br />Trying 127.0.0.1&#8230;<br />Connected to localhost.localdomain (127.0.0.1).<br />Escape character is &#8216;^]&#8217;.<br />220 Welcome to our mail.test.com ESMTP,Warning: Version not Available<br />EHLO localhost<br />250-mail.test.com<br />250-PIPELINING<br />250-SIZE 14336000<br />250-VRFY<br />250-ETRN<br />250-AUTH PLAIN LOGIN<br />250-AUTH=PLAIN LOGIN<br />250-ENHANCEDSTATUSCODES<br />250-8BITMIME<br />250 DSN<br />QUIT<br />221 2.0.0 Bye<br />Connection closed by foreign host.</p>
<p>7、通过amavisd测试发信</p>
<p>]# telnet localhost 10024<br />Trying 127.0.0.1&#8230;<br />Connected to localhost.localdomain (127.0.0.1).<br />Escape character is &#8216;^]&#8217;.<br />220 [127.0.0.1] ESMTP amavisd-new service ready<br />HELO localhost<br />250 [127.0.0.1]<br />MAIL FROM:&lt;&gt;<br />250 2.1.0 Sender &lt;&gt; OK<br />RCPT TO:&lt;postmaster&gt;<br />250 2.1.5 Recipient &lt;postmaster&gt; OK<br />DATA<br />354 End data with &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;<br />From:Anti-Virus tester<br />To: MailServer Admin<br />Subject:amavisd test!<br />amavisd test!!<br />.<br />250 2.0.0 Ok: queued as 263FC1A609<br />quit<br />221 2.0.0 [127.0.0.1] amavisd-new closing transmission channel<br />Connection closed by foreign host.</p>
<p>接下来通过WEB使用postmaster用户测试收信</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aease.org/2008/04/redhat-linuxpostfix-1.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux下安装mysql 5.0.56</title>
		<link>http://www.aease.org/2008/04/linuxmysql-5056.html</link>
		<comments>http://www.aease.org/2008/04/linuxmysql-5056.html#comments</comments>
		<pubDate>Tue, 08 Apr 2008 08:52:43 +0000</pubDate>
		<dc:creator>wind</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mysql]]></category>

		<guid isPermaLink="false">http://192.168.100.15/blog/2008/04/linuxmysql_5056.html</guid>
		<description><![CDATA[1. 下载并解包将网络下载的mysql-5.0.56.tar.gz文件放在/usr/local/src目录并解包 #cd /usr/local/src#tar xzvf mysql-5.0.56.tar.gz#cd mysql-5.0.56 2. 编译安装 #./configure &#8211;prefix=/usr/local/mysql &#8211;localstatedir=/var/lib/mysql &#8211;with-comment=Source &#8211;with-server-suffix=-enterprise-gpl &#8211;with-mysqld-user=mysql &#8211;without-debug &#8211;with-big-tables &#8211;with-charset=utf8 &#8211;with-collation=utf8_general_ci &#8211;with-extra-charsets=all &#8211;with-pthread &#8211;enable-static &#8211;enable-thread-safe-client &#8211;with-client-ldflags=-all-static &#8211;with-mysqld-ldflags=-all-static &#8211;enable-assembler &#8211;without-innodb &#8211;without-ndb-debug &#8211;without-isam &#8211;enable-local-infile &#8211;with-readline &#8211;with-raid如果编译成功，你会看到：Thank you for choosing MySQL! #make在此过程中遇到&#8221;/usr/bin/ld: cannot find -lncurses&#8221;错误，安装libncurses5-dev包后再次编译正常。 #make install安装完成 3. MYSQL配置#groupadd mysql#useradd -g mysql -s /bin/false -M mysql#cd /usr/local/mysql#bin/mysql_install_db &#8211;user=mysql安装MYSQL系统表 Installing MySQL [...]]]></description>
			<content:encoded><![CDATA[<p><font style="font-size: 1.25em;"><b>1. 下载并解包</b></font><br />将网络下载的mysql-5.0.56.tar.gz文件放在/usr/local/src目录并解包</p>
<blockquote><p>#<strong>cd</strong> /usr/local/src<br />#<strong>tar</strong> xzvf mysql-5.0.56.tar.gz<br />#<strong>cd</strong> mysql-5.0.56</p>
</blockquote>
<p><font style="font-size: 1.25em;"><b>2. 编译安装</b></font></p>
<blockquote><p><strong>#./configure</strong> <br />&#8211;prefix=/usr/local/mysql <br />&#8211;localstatedir=/var/lib/mysql <br />&#8211;with-comment=Source <br />&#8211;with-server-suffix=-enterprise-gpl <br />&#8211;with-mysqld-user=mysql <br />&#8211;without-debug <br />&#8211;with-big-tables <br />&#8211;with-charset=utf8 <br />&#8211;with-collation=utf8_general_ci <br />&#8211;with-extra-charsets=all <br />&#8211;with-pthread <br />&#8211;enable-static <br />&#8211;enable-thread-safe-client <br />&#8211;with-client-ldflags=-all-static <br />&#8211;with-mysqld-ldflags=-all-static <br />&#8211;enable-assembler <br />&#8211;without-innodb <br />&#8211;without-ndb-debug <br />&#8211;without-isam <br />&#8211;enable-local-infile <br />&#8211;with-readline <br />&#8211;with-raid<br />如果编译成功，你会看到：Thank you for choosing MySQL!</p>
</blockquote>
<p><span id="more-71"></span></p>
<p><strong>#make</strong><br />在此过程中遇到&#8221;/usr/bin/ld: cannot find -lncurses&#8221;错误，安装libncurses5-dev包后再次编译正常。</p>
<p><strong>#make install<br /></strong>安装完成</p>
<p><font style="font-size: 1.25em;"><b>3. MYSQL配置</b></font><br />#<strong>groupadd </strong>mysql<br />#<strong>useradd</strong> -g mysql -s /bin/false -M mysql<br />#<strong>cd</strong> /usr/local/mysql<br />#bin/mysql_install_db &#8211;user=mysql<br /><b>安装MYSQL系统表</b> </p>
<blockquote><p>Installing MySQL system tables&#8230;<br />OK<br />Filling help tables&#8230;<br />OK <br />&#8230;&#8230;</p>
</blockquote>
<p><b>设置目录文件权限</b><br />#<strong>chown</strong> -R root:mysql .<br />#<strong>chown</strong> -R mysql /var/lib/mysql<br />#<strong>chgrp</strong> -R mysql .<br />#<strong>cp</strong> share/mysql/my-medium.cnf /etc/my.cnf<br />#<strong>cp </strong>share/mysql/mysql.server /etc/rc.d/init.d/mysqld<br />#<strong>chmod</strong> 755 /etc/rc.d/init.d/mysqld</p>
<p><b>加入自动启动服务队列</b><br />#<strong> chkconfig</strong> &#8211;add mysqld</p>
<p><b>配置库文件搜索路径</b><br />#<strong>echo</strong> &#8220;/usr/local/mysql/lib&#8221; &gt;&gt; /etc/ld.so.conf &amp;&amp; ldconfig</p>
<p><b>开启或关闭mysqld服务</b><br />/etc/rc.d/init.d/<strong>mysqld</strong> start/stop<br /><strong>service</strong> mysqld start/stop </p>
<p><b>修改root初始密码</b><br />bin/<strong>mysqladmin</strong> -u root password &#8220;your password&#8221;</p>
<p><font style="font-size: 1.25em;"><b>4. 安装完成</b></font></p>
]]></content:encoded>
			<wfw:commentRss>http://www.aease.org/2008/04/linuxmysql-5056.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql的root密码重设</title>
		<link>http://www.aease.org/2008/03/mysqlroot.html</link>
		<comments>http://www.aease.org/2008/03/mysqlroot.html#comments</comments>
		<pubDate>Sun, 09 Mar 2008 03:28:04 +0000</pubDate>
		<dc:creator>wind</dc:creator>
				<category><![CDATA[Mysql]]></category>

		<guid isPermaLink="false">http://192.168.100.15/blog/2008/03/mysqlroot.html</guid>
		<description><![CDATA[在重设密码期间，MySql数据库完全出于没有密码保护的状态下，其它用户可以任意的登录和修改Mysql的信息，因此要确认服务器没其它用户连接。 1. 停止MySql服务　　mysqld stop 2. 修改MySql的登录设置　　# vi /etc/my.cnf　　在[mysqld]段中加入：　　skip-grant-tables 3. 重启Mysql服务　　mysqld start 4. 登录并修改Mysql的root密码　　#mysql　　mysql&#62; use mysql;　　mysql&#62;update user set password=password(&#8216;newpassword&#8217;) where user=&#8217;root&#8217;;　　mysql&#62;flush privileges; 5. 改回Mysql登录设置　　删除刚才在[mysqld]段中加的skip-grant-tables 6. 重启MySql服务　　#mysqld restart &#160;]]></description>
			<content:encoded><![CDATA[<div class="asset-more" id="more">
<p>在重设密码期间，MySql数据库完全出于没有密码保护的状态下，其它用户可以任意的登录和修改Mysql的信息，因此要确认服务器没其它用户连接。</p>
<p>1. 停止MySql服务<br />　　mysqld stop</p>
<p>2. 修改MySql的登录设置<br />　　# vi /etc/my.cnf<br />　　在[mysqld]段中加入：<br />　　skip-grant-tables</p>
<p>3. 重启Mysql服务<br />　　mysqld start</p>
<p>4. 登录并修改Mysql的root密码<br />　　#mysql<br />　　mysql&gt; <strong>use</strong> mysql;<br />　　mysql&gt;<strong>update</strong> user <strong>set</strong> password=<strong>password</strong>(&#8216;newpassword&#8217;) <strong>where </strong>user=&#8217;root&#8217;;<br />　　mysql&gt;<strong>flush privileges</strong>;</p>
<p>5. 改回Mysql登录设置<br />　　删除刚才在[mysqld]段中加的skip-grant-tables</p>
<p>6. 重启MySql服务<br />　　#mysqld restart</p>
</div>
<p><span id="more-58"></span></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aease.org/2008/03/mysqlroot.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
