È¡mysql±íºÍ×Ö¶Î×¢ÊÍ
È¡mysql±íºÍ×Ö¶Î×¢Ê͵ÄÓï¾ä
1¡¢È¡×Ö¶Î×¢ÊÍ
Select COLUMN_NAME ÁÐÃû, DATA_TYPE ×Ö¶ÎÀàÐÍ, COLUMN_COMMENT ×Ö¶Î×¢ÊÍ
from INFORMATION_SCHEMA.COLUMNS
Where table_name = 'companies'##±íÃû
AND table_schema = 'testhuicard'##Êý¾Ý¿âÃû
AND column_name LIKE 'c_name'##×Ö¶ÎÃû
2¡¢È¡µÃ±í×¢ÊÍ
Select table_name ±íÃû,TABLE_COMMENT ±í×¢ÊÍ from INFORMATION_SCHEMA.TABLES Where table_schema = 'testhuicard' ##Êý¾Ý¿âÃû
AND table_name LIKE 'companies'##±íÃû
²Î¿¼http://dev.mysql.com/doc/refman/5.1/zh/information-schema.html.
mysqlÊֲ᣺23.1. INFORMATION_SCHEMA±í
3¡¢È¡µÃijÊý¾Ý¿âÏÂËùÓбíµÄ×¢ÊÍ
$tt = mysql_query("show table status;");
$table_info£½array();
while($re = mysql_fetch_array($tt,MYSQL_ASSOC)){
//$re["Comment"],Õâ¸ö¾ÍÊDZíµÄ×¢ÊÍ
$table_info[] = $re;
}
Ïà¹ØÎĵµ£º
MySQL´´½¨¹ØÁª±í¿ÉÒÔÀí½âΪÊÇÁ½¸ö±íÖ®¼äÓиöÍâ¼ü¹Øϵ£¬µ«ÕâÁ½¸ö±í±ØÐëÂú×ãÈý¸öÌõ¼þ
1.Á½¸ö±í±ØÐëÊÇInnoDBÊý¾ÝÒý ......
MySQLÂý²éѯ¼Ç¼ÈÕÖ¾¶ÔÓÚ¸ú×ÙMySQL¸ºÔص÷ÓÅÎÊÌâºÜÓÐÓô¦£¬ÆäʵÆôÓÃMySQLµÄÂý²éѯÈÕÖ¾ºÜ¼òµ¥,Ö»ÐèÒªÔÚMySQLµÄÅäÖÃÎļþÀïÌí¼Ólog-slow-queriesºÍlong_query_timeÁ½¸ö²ÎÊý¼´¿É¡£
WindowsÏ¿ªÆôMySQLÂý²éѯ
MySQLÔÚWindowsϵͳÖеÄÅäÖÃÎļþÒ»°ãÊÇÊÇmy.iniÕÒµ½[mysqld]ÏÂÃæ¼ÓÉÏ
log-slow-queries = F:\MySQL\log\mysqls ......
µÚÒ»¡¢mysql·þÎñµÄÆô¶¯ºÍÍ£Ö¹
net stop mysql
net start mysql
µÚ¶þ¡¢µÇ½mysql
Óï·¨ÈçÏ£º mysql -uÓû§Ãû -pÓû§ÃÜÂë
¼üÈëÃüÁîmysql -uroot -p£¬ »Ø³µºóÌáʾÄãÊäÈëÃÜÂ룬ÊäÈë12345£¬È»ºó»Ø³µ¼´¿É½øÈëµ½mysqlÖÐÁË£¬mysqlµÄÌáʾ·ûÊÇ£º
mysql>
×¢Ò⣬Èç¹ûÊÇÁ¬½Óµ½ÁíÍâµÄ»úÆ÷ÉÏ£¬ÔòÐèÒª¼ÓÈëÒ»¸ö²ÎÊý-h»úÆ÷IP
µÚÈý¡ ......
GRANT ALL PRIVILEGES
1¡£ ¸Ä±í·¨¡£¿ÉÄÜÊÇÄãµÄÕʺŲ»ÔÊÐí´ÓÔ¶³ÌµÇ½£¬Ö»ÄÜÔÚlocalhost¡£Õâ¸öʱºòÖ»ÒªÔÚlocalhostµÄÄÇ̨µçÄÔ£¬µÇÈëmysqlºó£¬¸ü¸Ä "mysql" Êý¾Ý¿âÀïµÄ "user" ±íÀïµÄ "host" Ï´Ó"localhost"¸Ä³Æ"%"
Sql´úÂë ¸´ÖÆ´úÂë
1. mysql -u root -pvmwaremysql>use mysql;
  ......
ʹÓÃmysqlÓÖÓöµ½ÎÊÌâÁË£¬Õâ´ÎÊǹØÓÚÂÒÂëµÄ...
ÆäʵÎÒÒ²±È½ÏÁ˽â±àÂëµÄÎÊÌ⣬Ҳ֪µÀÂÒÂë²úÉúµÄÔÀí£¬¶øÇÒÍøÉ϶ÔmysqlµÄÂÒÂëÎÊÌâÒ²ÓбȽ϶àµÄ½â´ð£¬
µ«ÊǽñÌìÎÒÓöµ½µÄÕâ¸öÂÒÂëÈ´±È½ÏÆæ¹Ö,ÔÚwhenÓï¾äÖвúÉúÁËÆæ¹ÖµÄÂÒÂë¡£
create table my_table(id int, name varchar(50), born DateTime);
insert into my_table val ......