MySQL³£ÓõÄһЩÓÐЧÃüÁîÂÞÁÐ
¼ò¼òµ¥µ¥µÄÂÞÁÐһЩÈÕ³£³£ÓõÄMySQLÃüÁî¡£
show variables;
²é¿´Êý¾Ý¿âÅäÖõÄһЩÅäÖÃÏî
show status;
²é¿´µ±Ç°Æô¶¯µÄMySQL״̬
select @@autocommit;
²é¿´MySQLµ±Ç°Ö´ÐÐSQLµÄÌá½»ÀàÐÍ£¨ÊÇ·ñ×Ô¶¯Ìá½»£©
\s
µ±Ç°Á¬½ÓÊý¾Ý¿âÃû£¬Óû§Ãû£¬MySQL°æ±¾£¬×Ö·û¼¯µÈµÈ¡£
show create table table_name \G
²é¿´´´½¨±íµÄSQLÓï¾ä
describe table_name; µÈ¼ÛÓÚ show columns from table_name;
²é¿´±íµÄÿ¸ö×Ö¶ÎÏêϸÐÅÏ¢
show table status like "test" \G
²é¿´±íµÄ״̬£¬Èç±íÒýÇæÀàÐÍ£¬×Ö¶Î×î´ó³¤¶È£¬Ë÷Òý×î´ó³¤¶È£¬×ÔÔö³¤×ֶεÄÖµ£¬±í´´½¨Ê±¼ä£¬×îºó¸üÐÂʱ¼äµÈµÈ¡£
select last_insert_id();
²é¿´µ±Ç°»á»°×îºóÒ»´ÎÖ´ÐÐinsertÓï¾äµÄinset idÖµ
insert delay into table_name (field1, field2) values (v1, v2);
ÑÓ³ÙInsert£¬¶ÔInnoDB±íÎÞЧ
show processlist \G
²é¿´Á¬½Óµ½Êý¾Ý¿âµÄÏß³ÌÐÅÏ¢£¬¿ÉÒԲ鿴±íÊÇ·ñ±»ËøסµÈµÈ
mysqladmin -uÓû§Ãû -p¾ÉÃÜÂë passwordÐÂÃÜÂë
ÐÞ¸ÄÃÜÂë
grant select [insert][,update][,delete][,all] on Êý¾Ý¿â.* to Óû§Ãû@localhost[,"%"] identifiedby "ÃÜÂë"
Ôö¼ÓÓû§Ãû
flush privileges
show engine bdb logs;
²é¿´MySQLÈÕÖ¾Îļþ·¾¶
show master status
²é¿´Ö÷¿âµÄ¶þ½øÖÆÎļþ״̬
show slave hosts
²é¿´×¢²áµ½µ±Ç°»úÆ÷µÄ´ÓÊô»úÆ÷
Ïà¹ØÎĵµ£º
¼¸¸öÔÂÇ°£¬ÊÜһλÀÏʦµÄίÍУ¬Òª°ïËû×öÒ»¸ö¹ØϵÊý¾Ý¿âģʽÐÅÏ¢ÌáÈ¡µÄСÏîÄ¿£¬Ö÷ÒªµÄ¹¦ÄÜʵÏÖ¾ÍÊǽ«¹ØϵÊý¾Ý¿âµÄ±í½á¹¹ºÍ×ֶεÄÐÅϢͨ¹ý±í¸ñµÄÐÎʽչʾ³öÀ´¡£ÎÒͨ¹ý´ÓÍøÉÏËѼ¯×ÊÁÏÒÔ¼°·Êé²éÕÒ£¬ÏÈʵÏÖÁËÒ»¸ömysqlµÄÊý¾ÝÌáÈ¡Æ÷¡£Ïȸø´ó¼Ò·ÖÏíһϡ£ÉÔºóµÄ¼¸ÌìÄÚ»á°ÑÁíÒ»¸ömysql¹ ......
access denied for user 'root'@'localhost' (using password: YES);
½ñÌìÓÃmysqlµÄʱºò£¬µÇ¼µÄʱºò³öÏÖÁËÕâ¾ä£¬²»ÖªµÀÊÇʲôÒâ˼£¬ÒòΪÎÒµÄmysqlÊÇ×°centosµÄʱºòÒ»Æð×°µÄ£¬ÃÜÂëÎÒ¾ÍÊäÈëÎÒµÄÕÊ»§ÃÜÂ룬½á¹û³öÏÖÁËÉÏÃæÄǾ䣻°Ù¶ÈÁËһϣ¬»¹Õæ²»ÉÙÈ˳öÏÖÁËÕâ¸öÎÊÌâ¡£¡£×îºóÎÒÕÒµ½ÁË·½·¨£»
[root@localhost home]# mysql - ......
Íü¼ÇMySQL ROOTÃÜÂëÊÇÔÚMySQLʹÓÃÖкܳ£¼ûµÄÎÊÌ⣬¿ÉÊÇÓкܶàÅóÓѲ¢²»»áÖØÖÃROOTÃÜÂ룬Äǽпడ£¬ÎÒÓÐÉîÓид¥£¬ÌØд´ËÎÄÕÂÓë´ó¼Ò½»Á÷£º
1¡¢±à¼MySQL(ºÍPHP´îÅäÖ®×î¼Ñ×éºÏ)ÅäÖÃÎļþ£º
windows»·¾³ÖУº%MySQL_installdir%\my.ini
//Ò»°ãÔÚMySQL°²×°Ä¿Â¼ÏÂÓÐmy.ini¼´MySQLµÄÅäÖÃÎļþ¡£
linux»·¾³ÖУº/etc/my.cnf ......
mysql>use mysql;
mysql>update user set host='%' where user='root';
ÖØÆôMysql
sudo /etc/init.d/mysql restart
[sudo] password for wangzw:
*Stopping MySQL database server mysqld & ......