<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[静怡家园]]></title> 
<link>http://www.zhanghaijun.com/index.php</link> 
<description><![CDATA[书山有路勤为径，学海无涯苦作舟！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[静怡家园]]></copyright>
<item>
<link>http://www.zhanghaijun.com/post//</link>
<title><![CDATA[MySql 新建用户,新建数据库,用户授权,删除用户,修改密码]]></title> 
<author>碟舞飞扬 &lt;webmaster@zhanghaijun.com&gt;</author>
<category><![CDATA[数据库类]]></category>
<pubDate>Wed, 05 Nov 2008 06:32:32 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post//</guid> 
<description>
<![CDATA[ 
	1.新建用户。<br/>//登录MYSQL<br/>@>mysql -u root -p<br/>@>密码<br/>//创建用户<br/>mysql> mysql> insert into mysql.user(Host,User,Password,ssl_cipher,x509_issuer,x509_sub<br/>ject) values("localhost","pppadmin",password("passwd"),'','','');<br/><br/>这样就创建了一个名为：phplamp&nbsp;&nbsp; 密码为：1234&nbsp;&nbsp; 的用户。<br/><br/>然后登录一下。<br/><br/>mysql>exit;<br/>@>mysql -u phplamp -p<br/>@>输入密码<br/>mysql>登录成功<br/><br/>2.为用户授权。<br/><br/>//登录MYSQL（有ROOT权限）。我里我以ROOT身份登录.<br/>@>mysql -u root -p<br/>@>密码<br/>//首先为用户创建一个数据库(phplampDB)<br/>mysql>create database phplampDB;<br/>//授权phplamp用户拥有phplamp数据库的所有权限。<br/>>grant all privileges on phplampDB.* to phplamp@localhost identified by '1234';<br/>//刷新系统权限表<br/>mysql>flush privileges;<br/>mysql>其它操作<br/><br/>/*<br/>如果想指定部分权限给一用户，可以这样来写:<br/>mysql>grant select,update on phplampDB.* to phplamp@localhost identified by '1234';<br/>//刷新系统权限表。<br/>mysql>flush privileges;<br/>*/<br/><br/>3.删除用户。<br/>@>mysql -u root -p<br/>@>密码<br/>mysql>Delete FROM user Where User="phplamp" and Host="localhost";<br/>mysql>flush privileges;<br/>//删除用户的数据库<br/>mysql>drop database phplampDB;<br/><br/>4.修改指定用户密码。<br/>@>mysql -u root -p<br/>@>密码<br/>mysql>update mysql.user set password=password('新密码') where User="phplamp" and Host="localhost";<br/>mysql>flush privileges;<br/><br/>5.列出所有数据库<br/><br/>mysql>show database;<br/><br/>6.切换数据库<br/><br/>mysql>use '数据库名';<br/><br/>7.列出所有表<br/><br/>mysql>show tables;<br/><br/>8.显示数据表结构<br/><br/>mysql>describe 表名;<br/><br/>9.删除数据库和数据表<br/><br/>mysql>drop database 数据库名;<br/>mysql>drop table 数据表名;<br/>Tags - <a href="http://www.zhanghaijun.com/tags/mysql/" rel="tag">mysql</a>
]]>
</description>
</item><item>
<link>http://www.zhanghaijun.com/post//#blogcomment</link>
<title><![CDATA[[评论] MySql 新建用户,新建数据库,用户授权,删除用户,修改密码]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>