mysql ѧϰÊÖ¼Ç(1)
1.ÉèÖñäÁ¿
set @x = 2;
»ò:
select @x := max(fields) as max from table;
2.Éú³Éhtml»òxml
mysql -H -uroot -p databaseName Éú³ÉhtmlÎļþ
mysql -x -uroot -p databaseName Éú³ÉxmlÎļþ
3.mysql»á»°ÖеļǼ¹¦ÄÜ
msyql -ee=/usr/log -uroot -p
ÔÚ mysql> ÖпÉÒÔÓà \t À´È¡Ïû£¬Óà \T À´ÉèÖô˹¦ÄÜ
4.show status like '%connections%' À´²é¿´×î´óÁ¬½ÓÊý
show status like '%Uptime%' ²é¿´½ø³Ì
show processlist ²é¿´µ±Ç°Ö´ÐеÄsqlÓï¾ä
sqlµÄÂý²éѯÈÕÖ¾µÄ¿ÉÒÔ¿´³öÀ´ÊÇÄÄÒ»¸öÒ³Ãæ³öÁËÎÊÌâ
5.show character set ²é¿´×Ö·ûÉèÖÃ
show colllation like '%utf8%' ²é¿´collation(УÑé)£¬ci,cs,bin·Ö±ð´ú±íºöÂÔ´óСд£¬²»ºöÂÔ´óСд£¬¶þ½øÖÆ
6.create table t1 select * from t2 ÒÔt2Ϊ±ê×¼´´½¨Ð±ít1£¬²¢½«ËùÓÐÊý¾Ý×ªÒÆ¹ýÈ¥
7.alter table t1 engine = myisam ¸ü¸Ä engine Ϊ myisam
Ïà¹ØÎĵµ£º
1.ʲôÊÇUDF? UDF(user-defined function)ÊÇmysqlΪÓû§ÌṩµÄ×Ô¶¨Ò庯ÊýµÄÀ©Õ¹½Ó¿Ú¡£Ëü±¾ÖÊÉϺÍmysqlÌṩµÄmax¡¢minºÍcountµÈº¯ÊýÀàËÆ¡£ 2.UDF¿ÉÒÔ×öʲô? UDFÊÇ×Ô¶¨Ò庯Êý£¬ËùÒÔËüÄÜ×öʲôÍêȫȡ¾öÓÚÄãµÄʵÏÖ¡£UDF¿ÉÒÔÔÚÆÕͨµÄsql¡¢triggerÒÔ¼°store procedure±»µ÷ÓᣠÈç¹û×Ô¶¨ÒåÒ»¸ötcp_send(ip,port,msg)µ ......
mysqlÀï×î³£ÓõÄÈÕÖ¾ÓÐ4ÖÖ,·Ö±ðÊÇ:´íÎóÈÕÖ¾,¶þ½øÖÆÈÕÖ¾,²éѯÈÕÖ¾ÒÔ¼°Âú²éѯÈÕÖ¾. 1.´íÎóÈÕÖ¾»á¼Ç¼µ±mysqlÆô¶¯ºÍ¹Ø±ÕÒÔ¼°ÔËÐÐÖеĴíÎóÐÅÏ¢,¿ÉÒÔʹÓà --log-error[=file_name]À´Ö¸¶¨´íÎóÈÕÖ¾´æ·ÅÎļþ.µ±mysql serverÒì³£µÄʱºòÓ¦¸ÃÊ×ÏȲ鿴¸ÃÈÕÖ¾.ÆäʵÀïÃæÒ²Ã»Ê²Ã´,ÎÒÓ¢ÓïËļ¶Ã»¹ý,ÅäÉϴʰÔĿǰΪֹ»¹Ã»ÓÐÅöµ½½â¾ö²»Á˵ÄÎÊ ......
MysqlµÄ°²×°Îļþ¿ÉÒÔÖ±½Óµ½ http://www.mysql.com ÏÂÔØ£¬»ñµÃfor win32µÄ.zip°ü£¬½¨ÒéÑ¡Ôñ4.0.20d°æ±¾¡£
¡¡¡¡ÏÂÔØ»ñµÃMysqlµÄfor win32°²×°°üºó£¬ÓÃwinzip½âѹËõ£¬Ö±½ÓÔËÐÐsetup.exe£¬ÐèҪעÒâµÄÊÇÑ¡ÔñÒ»¸ö°²×°Â·¾¶£¬µ±È»£¬°²×°Â·¾¶¿ÉÒÔÈÎÒ⣬½¨ÒéÑ¡ÔñC:\MySQLĿ¼¡£°²×°Íê³ÉºóMySQLÒ²¾ÍÍê³ÉÁË¡£Ä¬ÈϵÄÓû§ÃûÊÇroot£¬ÃÜÂë ......
1¡¢µÇ½MySQL:
mysql -u root -p
2¡¢²é¿´Óû§ÐÅÏ¢
select user,host,password from mysql.user;
select user,host from mysql.user;
3¡¢ÉèÖÃÃÜÂë
set password for root@localhost=password('
ÔÚÕâÀïÌîÈërootÃÜÂë
');
4¡¢ÐÞ¸ÄÃÜÂë
·½·¨1£ºmysqladmin -u root -p password newpassword
·½·¨2£º ££mysql -u root ......
Ò»¡¢mysql·þÎñ²Ù×÷
1¡¢net start mysql //Æô¶¯mysql·þÎñ
2¡¢net stop mysql //Í£Ö¹mysql·þÎñ¡¡
3¡¢mysql -hÖ÷»úµØÖ· -uÓû§Ãû £pÓû§ÃÜÂë //½øÈëmysqlÊý¾Ý¿â
4¡¢quit //Í˳ömysql²Ù×÷
5¡¢mysqladmin -uÓû§Ãû -p¾ÉÃÜÂë password ÐÂÃÜÂë //¸ü¸ÄÃÜÂë
6¡¢grant select on Êý¾Ý¿â.* to Óû§Ãû@µÇ¼Ö÷»ú identifie ......