隨筆-22  評論-8  文章-0  trackbacks-0
          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

          //登錄MYSQL 

          @>mysql -u root -p
          @>密碼
          //創建用戶

          insert into mysql.user(host,user,password) values ("localhost","hbchen",p
          assword("hbchen"));
          這樣就創建了一個名為:hbchen 密碼為:hbchen (的)用戶。
          然后登錄一下。
          mysql>exit;
          @>mysql -u hbchen -p
          @>輸入密碼
          mysql>登錄成功
          2.為用戶授權。
          //登錄MYSQL(有ROOT權限)。我們里我們以ROOT身份登錄.
          @>mysql -u root -p
          @>密碼
          //首先為用戶創建一個數據庫(phplampDB)
          mysql>create database phplampDB;
          //授權phplamp用戶擁有phplamp數據庫(的)所有權限。
          >grant all privileges on phplampDB.* to hbchen@localhost identified by 'hbchen';
          //刷新系統權限表
          mysql>flush privileges;
          mysql>其它們操作
          /*
          如果想指定部分權限給一用戶,可以這樣來寫:
          mysql>grant select,update on phplampDB.* to hbchen@localhost identified by 'hbchen';
          //刷新系統權限表。
          mysql>flush privileges;
          */
          3.刪除用戶。
          @>mysql -u root -p
          @>密碼
          mysql>Delete FROM user Where User="hbchen" and Host="localhost";
          mysql>flush privileges;
          //刪除用戶(的)數據庫
          mysql>drop database phplampDB;
          4.修改指定用戶密碼。
          @>mysql -u root -p
          @>密碼
          mysql>update mysql.user set password=password('新密碼') where User="hbchen" and Host="localhost";
          mysql>flush privileges;
          5.列出所有數據庫
          mysql>show database;
          6.切換數據庫
          mysql>use '數據庫名';
          7.列出所有表
          mysql>show tables;
          8.顯示數據表結構
          mysql>describe 表名;
          9.刪除數據庫和數據表
          mysql>drop database 數據庫名;
          mysql>drop table 數據表名;

           例如:--新建用戶
          insert into mysql.user(host,user,password) values ("localhost","hbchen",p
          assword("hbchen"));
          ---授予權限
          grant all privileges on mysql.* to hbchen@localhost identified by 'hbchen';
          --授予部分權限
           grant select,update on mysql.* to hbhcen@localhost identified by 'hbchen';

          --更改密碼
          update mysql.user set password='123456'where User='hbchen';

          use mysql; 
          update user set password=password('hahaha') where user='hbchen';
          --刷新
          flush privileges;

          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
          posted on 2011-08-28 21:04 Hukin 閱讀(21717) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 喀喇沁旗| 沙雅县| 南木林县| 张家界市| 兴城市| 大丰市| 五大连池市| 桂东县| 四子王旗| 仙居县| 江津市| 明星| 阿拉尔市| 无极县| 乌兰县| 礼泉县| 银川市| 宜宾县| 梁平县| 凤山县| 石嘴山市| 边坝县| 衡东县| 绥滨县| 凤山市| 沐川县| 建始县| 安新县| 梅州市| 扬中市| 阆中市| 义乌市| 宜川县| 营口市| 衡山县| 泾源县| 新河县| 新巴尔虎右旗| 孝义市| 石狮市| 汝南县|