Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

MySQL°²×°Ö¸ÄÏ


MySQL°²×°Ö¸ÄÏ
Òª°²×° MySQL£¬¿ÉÒÔÔÚÖÕ¶ËÌáʾ·ûºóÔËÐÐÏÂÁÐÃüÁ
sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install php5-mysql
// °²×°php5-mysql Êǽ«phpºÍmysqlÁ¬½ÓÆðÀ´
Ò»µ©°²×°Íê³É£¬MySQL ·þÎñÆ÷Ó¦¸Ã×Ô¶¯Æô¶¯¡£Äú¿ÉÒÔÔÚÖÕ¶ËÌáʾ·ûºóÔËÐÐÒÔÏÂÃüÁîÀ´¼ì²é MySQL ·þÎñÆ÷ÊÇ·ñÕýÔÚÔËÐУº
sudo netstat -tap | grep mysql
µ±ÄúÔËÐиÃÃüÁîʱ£¬Äú¿ÉÒÔ¿´µ½ÀàËÆÏÂÃæµÄÐУº
tcp 0 0 localhost.localdomain:mysql *:* LISTEN -
Èç¹û·þÎñÆ÷²»ÄÜÕý³£ÔËÐУ¬Äú¿ÉÒÔͨ¹ýÏÂÁÐÃüÁîÆô¶¯Ëü£º
sudo /etc/init.d/mysql restart
½øÈëmysql
mysql -uroot -p
(ÊäÈëmysqlµÄrootÃÜÂë)
ÅäÖà MySQL µÄ¹ÜÀíÔ±ÃÜÂ룺
sudo mysqladmin -u root password newpassword


Ïà¹ØÎĵµ£º

PHP²Ù×÷MySQLµÄº¯Êý

(1)mysql_connect(Ö÷»ú,Óû§Ãû,¿ÚÁî);
·µ»ØÒ»¸öÁ¬½ÓºÅ.
×¢Òâ:mysql¸÷Óû§µÄ¿ÚÁî¿ÉÒÔËæ¸ÃÓû§ËùÔÚ»úÆ÷IPµØÖ·²»Í¬¶ø¸Ä±ä. ÁíÍâ,mSQLûÓÐÓû§Ãû»úÖÆ,ËùÒÔmsql_connectÖ»ÐèÒªÒ»¸öÖ÷»ú²ÎÊý.Ö÷»ú¿ÉÒÔÊÇIPµØÖ·»òÓòÃû.
(2)mysql_create_db(Êý¾Ý¿âÃû);
(3)mysql_select_db(Êý¾Ý¿âÃû,Á¬½ÓºÅ);
Á¬½ÓÒ»¸öÊý¾Ý¿â.
(4)mysql_q ......

Set MySQL to use UTF 8 and convert database

##/etc/my.cnf:
# [mysql]
# default-character-set=utf8
# [mysqld]
# character-set-server=utf8
# collation-server=utf8_general_ci
# [client]
# default-character-set=utf8
/etc/init.d/mysqld stop
/etc/init.d/mysqld start
# dump db
mysqldump -u dbuser -pdbpass --opt --skip-set-charset --defaul ......

MYSQLÍâ¼ü(Foreign Key)µÄʹÓÃ


ÔÚMySQL 3.23.44°æ±¾ºó£¬InnoDBÒýÇæÀàÐ͵ıíÖ§³ÖÁËÍâ¼üÔ¼Êø¡£
Íâ¼üµÄʹÓÃÌõ¼þ£º
1.Á½¸ö±í±ØÐëÊÇ
InnoDB±í£¬MyISAM±íÔÝʱ²»Ö§³ÖÍâ¼ü£¨¾Ý˵ÒÔºóµÄ°æ±¾ÓпÉÄÜÖ§³Ö£¬µ«ÖÁÉÙÄ¿Ç°²»Ö§³Ö£©£»
2.Íâ¼üÁбØÐ뽨Á¢ÁËË÷Òý£¬MySQL
4.1.2ÒÔºóµÄ°æ±¾ÔÚ½¨Á¢Íâ¼üʱ»á×Ô¶¯´´½¨Ë÷Òý£¬µ«Èç¹ûÔÚ½ÏÔçµÄ°æ±¾ÔòÐèÒªÏÔʾ½¨Á¢£»
3.Íâ¼ü¹Øϵµ ......

windowsÏÂÖØÉèmysqlµÄrootÃÜÂë

  ×î½üÒòΪÍüÁËmysqlµÄrootÃÜÂ룬ÉÏÍøGoogleһϣ¬ÏÖÔڰѲ½Öè¼Çһϣ¬·ÀÖ¹ÒÔºóÍüÁË¡£
ÎÒÓõÄÊÇxamppÈí¼þ°ü¡£
1.  Í£Ö¹mysql
2.  ´ò¿ªcmd£¬Çл»Ä¿Â¼µ½ \xampp\mysql\bin, ÔËÐÐ
   mysqld -skip-grant-tables
   ÕâÌõÃüÁîÊÇÌø¹ýȨÏÞ¼ì²éÆô¶¯mysql·þÎñ
3. ´ò¿ªÁíÒ»¸öcmd£¬Í¬ÑùÇл»Ä¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ