MySQLÊý¾Ý¿âÏê½â
´Ó±¾Æª²©ÎÄ¿ªÊ¼£¬ÎÒÃǾÍÒªÉîÈëµ½PHPµÄÓ¦Óõ±ÖÐÈ¥ÁË¡£PHPµÄÊý¾Ý¿âÓ¦ÓÃÊÇÖØÖÐÖ®ÖØ£¬±ØÐëÕÆÎÕ¡£Ñ¡ÔñʲôÑùµÄÊý¾Ý¿âÄØ£¬µ±È»ÊÇÎÒÃǵÄMySQLÀ²£¬Ã»ÓÐÈË»áȥʹÓÃÄÇЩÅÓ´ó¡¢µÍЧ¶øÓÖ°º¹óµÄÉÌÒµÊý¾Ý¿âÀ´¹¹½¨PHPÓ¦Óðɡ£
1 MySQLÊý¾Ý¿âµÄ°²×°
¹ýÈ¥£¬°²×°Ò»¸öMySQLÊý¾Ý¿â²¢ÇÒÒªÆô¶¯ÆðÀ´ºÜ·ÑÊ£¬ÌرðÊÇÔÚLinuxÕâÑùµÄ¿ª·¢»·¾³Ï£¬ÐèÒª¸üкܶàÀà¿â»òÕßÆäËû¶«¶«¡£²»¹ý£¬ÏÖÔÚÓÐÁËLAMP¼Ü¹¹£¬Ò»Çо¡ÔÚÕÆÎÕ£¡
Çë´Ó Apache Friends Web Õ¾µãÉÏÏÂÔØ×îеĶþ½øÖÆÎļþ²¢½øÐнâ°ü£º
xampp-linux-1.7.3.tar.gz¡£
http://sourceforge.net/projects/xampp/files/XAMPP%20Linux/1.7.3/xampp-linux-1.7.3.tar.gz/download
ʹÓÃÏÂÃæµÄÃüÁÆä½â¿ªµ½ /opt Ŀ¼ÖУº
tar xvfz xampp-linux-1.7.2.tar.gz
½âѹºó³öÏÖlamppÎļþ¼Ð£¬Ò»¶¨Òª½«lampp·Åµ½/opt ÏÂÃ棨·ñÔò²»ÄÜÆô¶¯£©¡£ÏÖÔÚËùÓеÄÈí¼þ¶¼ÒѾ°²×°ºÃÁË£¬ÈÃÎÒÃÇÆô¶¯ÐµÄÊØ»¤½ø³Ì¡£½«µ±Ç°µÄ¹¤×÷Ŀ¼Çл»µ½ /opt/lampp £¨ cd /opt/lampp£©²¢ÊäÈëÏÂÃæµÄÃüÁ
./lampp start
Æô¶¯ÆðÀ´ºó£¬ÎÒÃǾͿÉÒÔʹÓÃÆäÖеÄMySQLÄ£¿éÁË£º
# cd /opt/lampp/bin
# ./mysql
mysql>
2 ÐÞ¸ÄmysqlÃÜÂë
# ./mysqladmin -u root password 'new-password'
¸ñʽ£ºmysqladmin -uÓû§Ãû -p¾ÉÃÜÂë password ÐÂÃÜÂë
Àý1£º¸øroot¼Ó¸öÃÜÂë123456¡£
¡¡¡¡¼üÈëÒÔÏÂÃüÁî £º
¡¡¡¡ /opt/lampp/bin/mysqladmin -u root password 123456
¡¡¡¡×¢£ºÒòΪ¿ªÊ¼Ê±rootûÓÐÃÜÂ룬ËùÒÔ-p¾ÉÃÜÂëÒ»Ïî¾Í¿ÉÒÔÊ¡ÂÔÁË¡£²âÊÔÊÇ·ñÐ޸ijɹ¦£º
1£©²»ÓÃÃÜÂëµÇ¼
# ./mysql
2£©ÓÃÐ޸ĺóµÄÃÜÂëµÇ¼
# ./mysql -u root -p
¡¡¡¡Enter password: (ÊäÈëÐ޸ĺóµÄÃÜÂë123456)
¡¡¡¡Welcome to the MySQL monitor.¡¡Commands end with ; or \g.
¡¡¡¡Your MySQL connection id is 4 to server version: 4.0.16-standard
¡¡¡¡Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
¡¡¡¡mysql>
¡¡¡¡³É¹¦£¡
3)Í˳ömysqlÃüÁexit£¨»Ø³µ£©
3 Êý¾Ý¿âºÍ±íµÄ²Ù×÷
mysql> show databases;
ÏÔʾÈçÏÂÐÅÏ¢£º
+---------------------+
| Database |
+---------------------+
| information_schema |
| cluster_replication |
| mysql |
| test &nbs
Ïà¹ØÎĵµ£º
ÊýÖµÀàÐÍ
¡¡¡¡MySQL
µÄÊýÖµÊý¾ÝÀàÐÍ¿ÉÒÔ´óÖ»®·ÖΪÁ½¸öÀà±ð£¬Ò»¸öÊÇÕûÊý£¬ÁíÒ»¸öÊǸ¡µãÊý»òСÊý¡£Ðí¶à²»Í¬µÄ×ÓÀàÐͶÔÕâЩÀà±ðÖеÄÿһ¸ö¶¼ÊÇ¿ÉÓõģ¬Ã¿¸ö×ÓÀàÐÍÖ§³Ö²»Í¬´óСµÄÊý¾Ý£¬²¢ÇÒ
MySQL ÔÊÐíÎÒÃÇÖ¸¶¨ÊýÖµ×Ö¶ÎÖеÄÖµÊÇ·ñÓÐÕý¸ºÖ®·Ö»òÕßÓÃÁãÌî²¹¡£
¡¡¡¡±íÁгöÁ˸÷ÖÖÊýÖµÀàÐÍÒÔ¼°ËüÃǵÄÔÊÐí·¶Î§ºÍÕ¼ÓõÄÄÚ´æ¿Õ¼ä¡£
......
1.Í£µômysqld
service mysqld stop
2.ÖØÆômysqld£¬Ö¸¶¨²ÎÊý
service mysqld start --skip-networking --skip-grant-tables
»òÕß
/opt/mysql/bin/mysqld_safe --skip-networking --skip-grant-tables &
/opt/mysql/ÊÇÎÒµÄMYSQL°²×°Â·¾¶
skip-grant-tables:Á¬½ÓʱÌø¹ýÊ ......
http://javeye.javaeye.com/blog/558093
ÎÒÃÇÖªµÀ£¬group by¿ÉÒÔ½«sql²éѯ½á¹û°´ÕÕgroup byºóÃæÁнøÐзÖÀàÏÔʾ¡£±ÈÈ磺
Sql´úÂë
select
columnA,columnB
from
table
group
by
columnA,columnB
select columnA,columnB from table group by columnA,colum ......
×î½üÁ˽âÁËÒ»ÏÂMYSQL×¢È룬Ҳʵ¼Ê²Ù×÷ÁËһϣ¬È·Êµ·¢ÏÖÁËËûµÄÍþÁ¦¡£
Ò»¸ö×¢È멶´¿ÉÒÔÈÃÈËÖ±½ÓÄõ½·þÎñÆ÷ȨÏÞ¡£
×ܽáһϣº
1£¬Ä¿Â¼µÄȨÏÞ²»ÄÜÌ«¸ß£¬²»È»±ðÈËÄÜÍùÀïдÎļþ£¬ÒÔÇ°ÓÃ0777ÕæÊÇÌ«ÓÞ´ÀÁË¡£
2£¬Ñϸñ¹ýÂËÊý¾Ý£¬ÕûÐÎÒ»ÂÉתint»òÓÃmysql_escape_string
3£¬ÉèÖúÏÀíµÄÊý¾Ý¿âȨÏÞ£¬²»ÒªÓÃROOT,²»È»»áËÀµÃºÜ²Ò¡£
4 ......