隨筆-22  評(píng)論-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
          @>密碼
          //創(chuàng)建用戶

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

           例如:--新建用戶
          insert into mysql.user(host,user,password) values ("localhost","hbchen",p
          assword("hbchen"));
          ---授予權(quán)限
          grant all privileges on mysql.* to hbchen@localhost identified by 'hbchen';
          --授予部分權(quán)限
           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) 評(píng)論(0)  編輯  收藏

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 安达市| 寿宁县| 大埔县| 崇文区| 安达市| 噶尔县| 玉林市| 顺平县| 特克斯县| 曲松县| 三都| 洪湖市| 新疆| 广州市| 云阳县| 竹北市| 游戏| 玉门市| 嘉峪关市| 建水县| 金阳县| 公安县| 金山区| 静乐县| 大新县| 星子县| 肥东县| 永宁县| 濮阳市| 昌平区| 彭州市| 彰武县| 许昌市| 昂仁县| 漠河县| 湖北省| 天等县| 临桂县| 师宗县| 浑源县| 龙海市|