Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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


Ïà¹ØÎĵµ£º

mysql Âý²éѯ²éѯºÍÒýÆðÔ­Òò·ÖÎö

MySQLÓÐÒ»¸ö¹¦ÄܾÍÊÇ¿ÉÒÔlogÏÂÀ´ÔËÐеıȽÏÂýµÄsqlÓï¾ä£¬Ä¬ÈÏÊÇûÓÐÕâ¸ölogµÄ£¬ÎªÁË¿ªÆôÕâ¸ö¹¦ÄÜ£¬ÒªÐÞ¸Ämy.cnf»òÕßÔÚMySQLÆô¶¯µÄʱºò¼ÓÈëһЩ²ÎÊý¡£
Èç¹ûÔÚmy.cnfÀïÃæÐ޸ģ¬ÐèÔö¼ÓÈçϼ¸ÐÐ
long_query_time = 1
log-slow-queries =
log-queries-not-using-indexes
long_query_time ÊÇÖ¸Ö´Ðг¬¹ý¶à¾ÃµÄsql»á±»logÏÂÀ´£ ......

hibernate mysql ²åÈëÖÐÎÄ´íÎó

 Ê¹ÓÃhibernate mysql ²åÈëÖÐÎÄ´íÎó£º
 Ô­ÒòÖ®Ò»ÊÇ£º
  mysql µÄ×Ö·û±àÂëºÍhibernate´«µÝµÄ±àÂë²»Ò»Ñù£¬
  ÀýÈ磺
  mysql ½¨¿âµÄʱºò¿ÉÒÔÉèÖñàÂë:
  CREATE DATABASE db DEFAULT CHARACTER SET utf8;
 hibernate Á¬½ÓmysqlµÄ±àÂ룺
 jdbc:mysql://127.0.0.1:3306/db?useU ......

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

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

mysqlÊý¾Ý¿â±¸·ÝÓ뻹ԭ

mysqlÊý¾Ý¿â±¸·ÝÓ뻹ԭÃüÁ
±¸·Ý£º
ÈçÎÒÃÇÐèÒª°Ñ Êý¾Ý¿âÃûΪ£ºshopping µÄÊý¾Ý¿â±¸·Ý£º Óû§ÃûΪ£ºroot£¬ÃÜÂëΪ£º12345£¬ÄÇôÃüÁîÈçÏ£º
Ö±½Ó½øÈëdos£¬Èç¹ûûÓÐÅäÖÃmysqlµÄ»·¾³±äÁ¿£¬ÄÇôÐèÒª°ÑdosµÄµ±Ç°Ä¿Â¼Çл»µ½mysqlµÄbinĿ¼Ï£¬È»ºóÇÃÈëÒ»ÏÂÃüÁ
        mysqldump -uroo ......

MySql ´æ´¢¹ý³ÌÓαêʹÓÃʾÀý

DROP PROCEDURE IF exists pro_removeBillRemindByUserId;
create procedure pro_removeBillRemindByUserId(userId int)
begin
    declare ts varchar(500);
    declare cnt int default 0;
    declare f_ID,b  int;
    DECLARE cur_1 CURSOR ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ