¡¾Õª×ÔCSDNÂÛ̳¡¿mysqlÃüÁîÐг£ÓÃÃüÁî
mysqlÃüÁîÐг£ÓÃÃüÁî
µÚÒ»ÕС¢mysql·þÎñµÄÆô¶¯ºÍÍ£Ö¹
net stop mysql
net start mysql
µÚ¶þÕС¢µÇ½mysql
Óï·¨ÈçÏ£º mysql -uÓû§Ãû -pÓû§ÃÜÂë
¼üÈëÃüÁîmysql -uroot -p£¬ »Ø³µºóÌáʾÄãÊäÈëÃÜÂ룬ÊäÈë12345£¬È»ºó»Ø³µ¼´¿É½øÈëµ½mysqlÖÐÁË£¬mysqlµÄÌáʾ·ûÊÇ£º
mysql>
×¢Ò⣬Èç¹ûÊÇÁ¬½Óµ½ÁíÍâµÄ»úÆ÷ÉÏ£¬ÔòÐèÒª¼ÓÈëÒ»¸ö²ÎÊý-h»úÆ÷IP
µÚÈýÕС¢Ôö¼ÓÐÂÓû§
¸ñʽ£ºgrant ȨÏÞ on Êý¾Ý¿â.* to Óû§Ãû@µÇ¼Ö÷»ú identified by "ÃÜÂë"
È磬Ôö¼ÓÒ»¸öÓû§user1ÃÜÂëΪpassword1£¬ÈÃÆä¿ÉÒÔÔÚ±¾»úÉϵǼ£¬ ²¢¶ÔËùÓÐÊý¾Ý¿âÓвéѯ¡¢²åÈë¡¢Ð޸ġ¢É¾³ýµÄȨÏÞ¡£Ê×ÏÈÓÃÒÔrootÓû§Á¬Èëmysql£¬È»ºó¼üÈëÒÔÏÂÃüÁ
grant select,insert,update,delete on *.* to user1@localhost Identified by "password1";
Èç¹ûÏ£Íû¸ÃÓû§Äܹ»ÔÚÈκλúÆ÷Éϵǽmysql£¬Ôò½«localhost¸ÄΪ"%"¡£
Èç¹ûÄã²»Ïëuser1ÓÐÃÜÂ룬¿ÉÒÔÔÙ´òÒ»¸öÃüÁÃÜÂëÈ¥µô¡£
grant select,insert,update,delete on mydb.* to user1@localhost identified by "";
µÚËÄÕУº ²Ù×÷Êý¾Ý¿â
µÇ¼µ½mysqlÖУ¬È»ºóÔÚmysqlµÄÌáʾ·ûÏÂÔËÐÐÏÂÁÐÃüÁÿ¸öÃüÁîÒԷֺŽáÊø¡£
1¡¢ ÏÔʾÊý¾Ý¿âÁÐ±í¡£
show databases;
ȱʡÓÐÁ½¸öÊý¾Ý¿â£ºmysqlºÍtest¡£ mysql¿â´æ·Å×ÅmysqlµÄϵͳºÍÓû§È¨ÏÞÐÅÏ¢£¬ÎÒÃǸÄÃÜÂëºÍÐÂÔöÓû§£¬Êµ¼ÊÉϾÍÊǶÔÕâ¸ö¿â½øÐвÙ×÷¡£
2¡¢ ÏÔʾ¿âÖеÄÊý¾Ý±í£º
use mysql;
show tables;
3¡¢ ÏÔʾÊý¾Ý±íµÄ½á¹¹£º
describe ±íÃû;
4¡¢ ½¨¿âÓëɾ¿â£º
create database ¿âÃû;
drop database ¿âÃû;
5¡¢ ½¨±í£º
use ¿âÃû;
create table ±íÃû(×Ö¶ÎÁбí);
drop table ±íÃû;
6¡¢ Çå¿Õ±íÖмǼ£º
delete from ±íÃû;
7¡¢ ÏÔʾ±íÖеļǼ£º
select * from ±íÃû;
µÚÎåÕС¢µ¼³öºÍµ¼ÈëÊý¾Ý
1. µ¼³öÊý¾Ý£º
mysqldump --opt test > mysql.test
¼´½«Êý¾Ý¿âtestÊý¾Ý¿âµ¼³öµ½mysql.testÎļþ£¬ºóÕßÊÇÒ»¸öÎı¾Îļþ
È磺mysqldump -u root -p123456 --databases dbname > mysql.dbname
¾ÍÊÇ°ÑÊý¾Ý¿âdbnameµ¼³öµ½Îļþmysql.dbnameÖС£
2. µ¼ÈëÊý¾Ý:
mysqlimport -u root -p123456 < mysql.dbname¡£
²»ÓýâÊÍÁË°É¡£
3. ½«Îı¾Êý¾Ýµ¼ÈëÊý¾Ý¿â:
Îı¾Êý¾ÝµÄ×Ö¶ÎÊý¾ÝÖ®¼äÓÃtab¼ü¸ô¿ª¡£
use test;
load data local infile "ÎļþÃû" into table ±íÃû;
£¬ÒÔ϶¼ÊÇMySQL5.0ϲâÊÔͨ¹ýÊ×ÏÈ˵Ã÷Ï£¬¼ÇסÔÚÿ¸öÃüÁî½áÊøʱ¼ÓÉÏ£»£¨·ÖºÅ£©
2007Äê11ÔÂ05ÈÕ ÐÇÆÚÒ» 11:06
Ïà¹ØÎĵµ£º
×öÏîĿʱÓÉÓÚÒµÎñÂß¼µÄÐèÒª£¬±ØÐë¶ÔÊý¾Ý±íµÄÒ»Ðлò¶àÐмÓÈëÐÐËø£¬¾Ù¸ö×î¼òµ¥µÄÀý×Ó£¬Í¼Êé½èÔÄϵͳ¡£¼ÙÉè id=1 µÄÕâ±¾Êé¿â´æΪ 1 £¬µ«ÊÇÓÐ 2 ¸öÈËͬʱÀ´½èÕâ±¾Ê飬´Ë´¦µÄÂ߼Ϊ
view plaincopy to clipboardprint?
Select restnum from book where id =1 ; ......
½üÀ´¶Ôphp±È½Ï¸ÐÐËȤ£¬¾Í¶Ï¶ÏÐøÐøµÄ»¨ÁËÁ½¸öÐÇÆÚµÄʱ¼ä°ÑÕû¸öphp¿ª·¢ÐèÒªÓõ½µÄ¶«Î÷¶¼×°ºÃÁË£¬´ó¸ÅµÄ°²×°¹ý³ÌÈçÏ¡£
Ò»¡¢°²×°µÄÈí¼þ:
Apache: 2.2.14
PHP:5.2.12
MySQL:5.1.42¡£
SVN:1.5.6
PHPMyAdmin:3.2.5
Zend Studio: 7.1
Zend Debugger: 5.1.14
¶þ¡¢°²×°¹ý³Ì£º
1. °²×°ºÍÅäÖÃapache
°²×°£ºÊ×ÏÈ´Óhttp://apa ......
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ÏÂÀ´£ ......