Äã±ØÐëÖ´Ðлù±¾µÄÖ¸Áî°²×°MySQLÔ´Âë°ü£¨Ò»¸öδ½â°üµÄ tar Îļþ£©£º³ÉΪ root, ÓÃsu ÃüÁî
----------------------------------------------------------------
$ su
---------------------------------------------------------------
¸Ä±ä·¾¶½øÈë°²×°ÎļþĿ¼¡£ (ʹÓà /tmp/download/)
--------------------------------------------------------------------------------
# cd /tmp/download/
--------------------------------------------------------------------------------
ÓÃÏÂÁÐÃüÁîÕ¹¿ªÎļþ¡£
--------------------------------------------------------------------------------
# gunzip -d -c mysql-3.22.xx.tar.gz | tar xvf
--------------------------------------------------------------------------------
½øÈëÐÂĿ¼. ÕâÔÚ½âѹ¹ý³ÌÖб»´´½¨¡£
--------------------------------------------------------------------------------
# cd mysql-3.22.xx
--------------------------------------------------------------------------------
ÏÖÔÚ¿ÉÒÔ¶ÔΪMySQL·þÎñÆ÷ÔËÐÐ"configure"Ö¸Áî¡£Äã¿ÉÒÔÔÚÖ´ÐÐconfigureÃüÁîʱָ¶¨ºÜ¶àÑ¡ÏʹÓÃconfigure -help£¬¿ÉÒÔ°ïÖúÄãÁ˽âËùÓÐÅäÖÃʱµÄÑ¡ÏѡÔñ--prefixÖ¸¶¨Ö±½Ó°²×°Â·¾¶¡£Configure½«¼ì²éÄãµÄ±àÒëÆ÷ºÍÆäËûһЩ¶«Î÷¡£Èç¹û·¢ÏÖ´íÎ󣬿ÉÒÔͨ¹ý²é¿´config.cacheÀ´¼ì²é¡£
--------------------------------------------------------------------------------
# configure --prefix=/usr/local/mysql
--------------------------------------------------------------------------------
ÔÚÍê³É Config ºó£¬Í¨¹ýÖ´ÐÐÏÂÃæÃüÁ¿ÉÒԵõ½Êµ¼Ê¶þ½øÖÆÎļþ¡£
--------------------------------------------------------------------------------
# make
--------------------------------------------------------------------------------
ÏÖÔÚ¿ÉÒÔ×¼±¸°²×°ËùÓеĶþ½øÖÆÎļþ¡£ ÔËÐÐÏÂÁÐÖ¸ÁîÔÚconfigure -prefixÑ¡ÔñµÄĿ¼Ï°²×°¶þ½øÖÆÎļþ¡£
--------------------------------------------------------------------------------
# make install
--------------------------------------------------------------------------------
°²×°Íê¶þ½øÖÆÎļþºó, ¾Í¿ÉÒÔ´´½¨mysql±í£¬¸Ã±í¿ÉÒԹ涨ʹÓÃȨÏÞ¡£
--------------------------------------------------------------------------------
# scripts/mysql_install_db
# cd /usr/local/mysql/bin
# ./safe_mysqld &
# ./mysqladmin -u root password ew-password
--------------------------------------------------------------------------------
×¢Òâ: /usr/local/mysql ÊÇÑ¡Ôñ°²×°MySQL·þÎñÆ÷µÄ·¾¶. ÄãÒ²¿ÉÒÔ°²×°ÔÚÆäËü·¾¶¡£
ΪÁËÈ·±£MySQLÄÜÕý³£¹¤×÷£¬ÐèÒªÔËÐÐһЩ¼òµ¥µÄ²âÊÔ. Èç¹ûÊä³ö½á¹û: BINDIR = /usr/local/mysql/bin£¬¾ÍÖ¤Ã÷MySQL¹¤×÷Õý³£. BINDIR µÄÖµÓëÉÏÃæÑ¡ÔñµÄprefix Ñ¡ÏîÓйء£
--------------------------------------------------------------------------------
# BINDIR/mysqlshow -p
+---------------+
| Databases |
+---------------+
| mysql |
+---------------+
--------------------------------------------------------------------------------
Ò»µ©Äã°²×°ÁËMySQL, Ëü½«»á×Ô¶¯Éú³ÉÁ½¸öÊý¾Ý¿â¡£Ò»¸öÓÃÓÚ¹ÜÀíÓû§¡¢Ö÷»úºÍ·þÎñÆ÷Êý¾Ý¿âȨÏÞ¡£ÁíÒ»¸öÊDzâÊÔÊý¾Ý¿â£¨test database£©¡£ÎÒÃÇ¿ÉÒÔʹÓòâÊÔÊý¾Ý¿â¡£ µ«ÊÇ£¬ÎÒÃÇÏë¼òµ¥¿ì½ÝµÄÏòÄã½éÉÜMySQLÖÐһЩ¿ÉʹÓõÄÖ¸ÁîµÄ¸Åò¡£Õ⻹¿ÉÒÔÈ·±£ root ±»ÉèÖÃΪÄܹ»ÍêÈ«·ÃÎÊ·þÎñÆ÷£¬ÀýÈç: root¿ÉÒÔÔÊÐí´´½¨Êý¾Ý¿â¡¢±íµ¥µÈ.. ËùÒÔÎÒÃǽ«´´½¨Ò»¸ötest2Êý¾Ý¿âÓÃÓÚÒÔºóµÄ²âÊÔ¡£ÔÚͨ¹ýÖ¸Áî½øÈëMySQLÇ°£¬ÏµÍ³½«ÌáʾÊäÈëд´½¨µÄroot¿ÚÁî¡£ Ó¦¸Ã¼ÇµÃÄãÒѸĹý rootµÄ¿ÚÁîÁË¡£
--------------------------------------------------------------------------------
# mysql -u root -p
mysql> show databases;
+----------------+
| Database |
+----------------+
| mysql |
| test |
+----------------+
mysql> create database test2;
Query OK, 1 row affected (0.00 sec)
--------------------------------------------------------------------------------
°´ÕÕÏÂÃæÁ½¶Î´úÂ룬ѡÔñʹÓÃеÄÊý¾Ý¿â£¬²¢´´½¨Ò»¸öÃû³ÆΪtst_tblµÄ±í£¬ ËüÓÐÁ½¸ö×ֶΡ£µÚÒ»¸ö×ֶΣ¨field 1£©Îªid ×ֶΣ¬Í¨¹ýËü¿ÉÒÔ¿´µ½¼Ç¼µÄidºÅ¡£´Ó±¾ÖÊÉÏ¿´£¬ÕâÖ»ÊÇÒ»Áд¿Êý×Ö¡£µÚ¶þ¸ö×Ö¶ÎΪÃû³Æ×ֶΣ¬ÔÚÆäÖпÉÒÔ´æ´¢ÊéµÄÃû³Æ¡£ÕâЩ×ֶεĸñʽΪ£º field 1 (id) Ϊ³¤¶ÈΪ3µÄÕûÊýÐÍ(int)£¬ field 2 (name)Ϊ³¤¶ÈΪ50µÄ×Ö·û´®ÐÍ(char)¡£ ÎÒÃǶÔidµÄ¸³Öµ¿ÉÒÔ¶ÔÊý¾Ý²éÕҺͱêÒý¡£
--------------------------------------------------------------------------------
mysql> use test2;
Database changed
mysql> CREATE TABLE books ( id int(3) not null
-> auto_increment, name char(50) not null,
-> unique(id), primary key(id));
Query OK, 0 rows affected (0.00 sec)
--------------------------------------------------------------------------------
ÏÖÔÚÓÃÏÂÃæÃüÁî¼ì²é¿âÊÇ·ñÕýÈ·¡£
mysql> show tables;
+---------------------+
| Tables in test2 |
+---------------------+
| books |
+---------------------+
1 row in set (0.00 sec)
mysql> describe books;
+-------+-------------+------+------+----------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+------+----------+----------------+
| id | int(3) | | PRI | 0 | auto_increment |
| name | char(50) | |
+-------+-------------+------+------+----------+----------------+
2 rows in set (0.00 sec)
--------------------------------------------------------------------------------
×¢Ò⣺describeÖ¸Áî»ù±¾Ãè»æ³ö±íµÄ²¼¾Ö¡£ ºÃ¿áѽ!
OK, ÏÂÃæ½éÉÜһЩÕæÕýÓÐÓõÄSQLÖ¸ÁÈçºÎÔÚÊý¾Ý¿âÖвåÈëºÍÑ¡ÔñÊý¾Ý¡£ÏÖÔÚ¿ÉÒÔÏòн¨±íÖмÓÈ뼸Ìõ¼Ç¼¡£ÐèÒª¼Çס£¬ÕâЩֻÊÇÊé¼®Ãû³ÆµÄ¼òµ¥¼Ç¼£¬µ«µ±Äã¶ÔSQLÓÐ×ã¹»µÄ¾Ñé¾Í¿ÉÒÔ½¨Á¢´óÐ͵ç×ÓÉÌÎñÕ¾µãµÄ¸´ÔÓÊý¾Ý¿â¡£ÈÃÎÒÃÇ´´½¨Á½¸ö¼ÙÏëµÄÊé¼®µÄ¼Ç¼¡£Ò»Ìõ¼Ç¼ÊÇ"PHP 4 Newbies"ÊéµÄÃû³Æ£¬ÁíÒ»Ìõ¼Ç¼ΪLinuxÏÂÒ»¸öÓÐÓõÄÊé"Red Hat Linux 6 Server"µÄÃû³Æ£¬ÓÉMohammed J. KabirÖø¡£
--------------------------------------------------------------------------------
mysql> INSERT INTO books (name) values(PHP 4 Newbies);
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO books (name) values(Red Hat Linux 6 Server);
Query OK, 1 row affected (0.00 sec)
--------------------------------------------------------------------------------
ÏÖÔÚ¼ì²éÒ»ÏÂеļǼ£¬²¢ÊìϤһÏÂselectÖ¸Áî¡£
--------------------------------------------------------------------------------
mysql> SELECT * from books;
+----+----------------------------------+
| id | name |
+----+----------------------------------+
| 1 | PHP for Newbies |
| 2 | Red Hat Linux 6 Server |
+----+----------------------------------+
2 rows in set (0.00 sec)
--------------------------------------------------------------------------------
ÕâÑùMySQL·þÎñÆ÷µÄ¾ÍÒѾÄÜÕý³£ÔËÐÐÁË¡£ÎÒÃÇ¿ÉÒÔ¼ÌÐøÔö¼Ó¼Ç¼£¬µ«ÊÇÔڴ˾ÍûÓиü¶àÒâÒåÁË¡£
×¢Ò⣺µ±ÄãÏòÊý¾Ý¿â²åÈë¼Ç¼ʱ£¬²»±ØÖ¸¶¨id¡£ÕâÊÇÒòΪÄã´´½¨id ×Ö¶ÎÓÐ×Ô¶¯Ôö¼ÓµÄÑ¡Ïî¡£
ÏÂÃæ½éÉÜÈçºÎ½øÐпìËÙɾ³ý¡£ÕâÖ»ÊǸøÄãÒ»¸ö¼òµ¥ÐÅÏ¢£¬¼ÇסÄã¿ÉÒÔÔÚmysql webÕ¾µãhttp://www.mysql.comÕÒµ½ËùÓÐÄãËùÏëÒªµÄmysqlÖ¸ÁîºÍ·þÎñÆ÷µÄÐÅÏ¢¡£
--------------------------------------------------------------------------------
mysql> delete from books where id=1;
Query OK, 1 row affected (0.00 sec)
mysql> select * from books;
+----+-----------------------------------+
| id | name |
+----+-----------------------------------+
| 2 | Red Hat Linux 6 Server |
+----+-----------------------------------+
1 row in set (0.00 sec)
--------------------------------------------------------------------------------
Ok, Í˳öMySQL²¢¼ÌÐø½øÐÐÏÂÒ»²½°²×°¡£ÔÚÍê³ÉËùÓа²×°²¢ÇÒÒ»Çй¤×÷Õý³£ºó£¬Äã¾Í¿ÉÒÔÔËÐÐMySQLÁË¡£
ÒÀÒÀÑîÁø ÓÚ 2006-07-30 09:18:50·¢±í:
ÎÒϵÄÊÇ×îеÄmysql°æ±¾5.1µÄ±ê×¼°æ
×°ÁË
¾ÍÊDz»»áÓð¡
ºÃÏñÿ¸ö°æ±¾µÄ°²×°¶¼Óе㲻ͬŶ
HYCOG ÓÚ 2006-07-21 15:34:12·¢±í:
¸Ðл