甜咖啡

          我的IT空間

          mysql免安裝版使用手冊

          mysql這個數(shù)據(jù)庫是開源的,尤其適合一些輕量級的軟件開發(fā),但是其安裝過程與使用過程總是讓一些初學者摸不著頭腦。我也是從這樣的痛苦中過來的,在此希望我的經(jīng)驗對小菜們有些許幫助。

          1.下載地址:

          http://www.5ipopo.com/soft/17815.html

          2.配置參數(shù)

          1)解壓縮綠色版軟件到D:\Java\mysql-5.1.14-beta-win32。

          2)修改D:\Java\mysql-5.1.14-beta-win32\my-small.ini文件內(nèi)容,添加紅色內(nèi)容:

          [client]
          #password = your_password
          port  = 3306
          socket  = /tmp/mysql.sock
          default-character-set=gbk

          [mysqld]
          port  = 3306
          socket  = /tmp/mysql.sock
          default-character-set=gbk
          skip-locking
          key_buffer = 16K
          max_allowed_packet = 1M
          table_cache = 4
          sort_buffer_size = 64K
          read_buffer_size = 256K
          read_rnd_buffer_size = 256K
          net_buffer_length = 2K
          thread_stack = 64K

          3.安裝MySQL5的服務,服務名自己定義為MySQL5

          1)在DOS窗口下進入D:\Java\mysql-5.1.14-beta-win32\bin目錄

          開始——運行——cmd

          2)執(zhí)行安裝MySQL服務名的命令:

          D:\Java\mysql-5.1.14-beta-win32\bin> mysqld --install MySQL5 --defaults-file=D:\Java\mysql-5.1.14-beta-win32\my-small.ini

          請注意紅色字體中的粗體部分,此為你mysql的路徑,不要一味的粘貼。)
          【數(shù)據(jù)庫學習筆記】MySQL5綠色版安裝教程(自己總結(jié))

          3)啟動MySQL5服務:

          D:\Java\mysql-5.1.14-beta-win32\bin>net start mysql5

          【數(shù)據(jù)庫學習筆記】MySQL5綠色版安裝教程(自己總結(jié))

          4)登陸MySQL5服務器

          D:\Java\mysql-5.1.14-beta-win32\bin>mysql -uroot -p

          注意密碼為空,直接按回車就可以了。

          【數(shù)據(jù)庫學習筆記】MySQL5綠色版安裝教程(自己總結(jié))

          5)查看數(shù)據(jù)庫:

          mysql>show databases;

          【數(shù)據(jù)庫學習筆記】MySQL5綠色版安裝教程(自己總結(jié))

           

          安裝部分到此結(jié)束,此后為操作部分,轉(zhuǎn)載自網(wǎng)上。

           

          6)使用數(shù)據(jù)庫
          mysql>
           use test 
          Database changed

          7)查看數(shù)據(jù)庫中的表
          sql>
           show tables; 
          Empty set (0.00 sec)

          8)創(chuàng)建表ttt
          mysql>
           create table ttt(a int,b varchar(20)); 
          Query OK, 0 rows affected (0.00 sec)

          9)插入三條數(shù)據(jù)
          mysql>
           insert into ttt values(1,'aaa'); 
          Query OK, 1 row affected (0.02 sec)

          mysql>
           insert into ttt values(2,'bbb'); 
          Query OK, 1 row affected (0.00 sec)

          mysql>
           insert into ttt values(3,'ccc'); 
          Query OK, 1 row affected (0.00 sec)

          10)查詢數(shù)據(jù)
          mysql>
           select * from ttt; 
          +------+------+
          | a      | b       |
          +------+------+
             1 | aaa     |
             2 | bbb    |
             3 | ccc     |
          +------+------+
          3 rows in set (0.00 sec)

          11)刪除數(shù)據(jù)
          mysql>
           delete from ttt where a=3; 
          Query OK, 1 row affected (0.01 sec)

          刪除后查詢操作結(jié)果:
          mysql>
           select * from ttt; 
          +------+------+
          | a    | b         |
          +------+------+
             1 | aaa      |
             2 | bbb     |
          +------+------+
          2 rows in set (0.00 sec)

          12)更新數(shù)據(jù)
          mysql>
           update ttt set b = 'xxx' where a =2; 
          Query OK, 1 row affected (0.00 sec)
          Rows matched: 1  Changed: 1  Warnings: 0

          查看更新結(jié)果:
          mysql>
           select * from ttt;+------+------+
          | a    | b          |
          +------+------+
             1 | aaa      |
             2 | xxx       |
          +------+------+
          2 rows in set (0.00 sec)

          13)刪除表
          mysql>
           drop table ttt; 
          Query OK, 0 rows affected (0.00 sec)

          查看數(shù)據(jù)庫中剩余的表:
          mysql>
           show tables; 
          Empty set (0.00 sec)


          3.更改MySQL5數(shù)據(jù)庫root用戶的密碼

          1)使用mysql數(shù)據(jù)庫
          mysql>
           use mysql 
          Database changed

          2)查看mysql數(shù)據(jù)庫中所有的表
          mysql>
           show tables; 
          +---------------------------+
          | Tables_in_mysql           |
          +---------------------------+
          | columns_priv              |
          | db                        |
          | func                      |
          | help_category             |
          | help_keyword              |
          | help_relation             |
          | help_topic                |
          | host                      |
          | proc                      |
          | procs_priv                |
          | tables_priv               |
          | time_zone                 |
          | time_zone_leap_second     |
          | time_zone_name            |
          | time_zone_transition      |
          | time_zone_transition_type |
          | user                      |
          +---------------------------+
          17 rows in set (0.00 sec)

          3)刪除mysql數(shù)據(jù)庫中用戶表的所有數(shù)據(jù)
          mysql>
           delete from user; 
          Query OK, 3 rows affected (0.00 sec)

          4)創(chuàng)建一個root用戶,密碼為“xiaohui”。
          mysql>
           grant all on *.* to root@'%' identified by 'xiaohui' with grant option; 
          Query OK, 0 rows affected (0.02 sec)

          5)查看user表中的用戶
          mysql>
           select User from user; 
          +------+
          | User |
          +------+
          | root |
          +------+
          1 row in set (0.00 sec)

          6)重啟MySQL5:更改了MySQL用戶后,需要重啟MySQL服務器才可以生效。
          D:\mysql-5.0.67-win32\bin>
          net stop mysql5 
          MySQL5 服務正在停止..
          MySQL5 服務已成功停止。

          D:\mysql-5.0.67-win32\bin>
          net start mysql5 
          MySQL5 服務正在啟動 .
          MySQL5 服務已經(jīng)啟動成功。

          7)重新登陸MySQL5服務器
          D:\mysql-5.0.67-win32\bin>
          mysql -uroot -pxiaohui 
          Welcome to the MySQL monitor.  Commands end with ; or \g.
          Your MySQL connection id is 1
          Server version: 5.0.67-community MySQL Community Edition (GPL)

          Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

          mysql>

          4.數(shù)據(jù)庫的創(chuàng)建與刪除

          1)創(chuàng)建數(shù)據(jù)庫testdb
          mysql>
           create database testdb; 
          Query OK, 1 row affected (0.02 sec)

          2)使用數(shù)據(jù)庫testdb
          mysql>
           use testdb; 
          Database changed

          3)刪除數(shù)據(jù)庫testdb
          mysql>
           drop database testdb; 
          Query OK, 0 rows affected (0.00 sec)

          4)退出登陸
          mysql>
           exit 
          Bye

          5.操作數(shù)據(jù)庫數(shù)據(jù)的一般步驟

          1、啟動MySQL服務器
          2、登陸數(shù)據(jù)庫服務器
          3、使用某個要操作的數(shù)據(jù)庫
          4、操作該數(shù)據(jù)庫中的表,可執(zhí)行增刪改查各種操作。
          5、退出登陸。

          6.mysql5的卸載 
          刪除服務,執(zhí)行mysqld --remove MySQL5 即可。

          posted on 2011-09-16 17:58 甜咖啡 閱讀(2136) 評論(1)  編輯  收藏

          評論

          # re: mysql免安裝版使用手冊 2013-01-15 12:37 李沙

          你寫的太詳細了,按你寫的一步一步執(zhí)行下來,沒錯,多謝分享!  回復  更多評論   


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


          網(wǎng)站導航:
           

          導航

          <2013年1月>
          303112345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          統(tǒng)計

          常用鏈接

          留言簿(1)

          我參與的團隊

          隨筆檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 越西县| 苏尼特左旗| 富民县| 阿拉善左旗| 奉化市| 河东区| 晋宁县| 海淀区| 茶陵县| 新平| 佛教| 高州市| 闽侯县| 渝中区| 仙游县| 乌鲁木齐县| 新乡县| 辽阳县| 察隅县| 内黄县| 宁德市| 社会| 邵阳县| 太和县| 金坛市| 二连浩特市| 河津市| 尚志市| 平遥县| 敦煌市| 青岛市| 永清县| 甘泉县| 孟津县| 鹤山市| 阿坝县| 车致| 南阳市| 上犹县| 安乡县| 蒲城县|