MySQLÊý¾Ý¿âµÄ»ù±¾²Ù×÷ÃüÁî
Ò»¡¢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 Óû§Ãû@µÇ¼Ö÷»ú identified by "ÃÜÂë" //Ôö¼ÓÐÂÓû§
exemple:
Àý2¡¢Ôö¼ÓÒ»¸öÓû§test2ÃÜÂëΪabc,ÈÃËûÖ»¿ÉÒÔÔÚlocalhostÉϵǼ£¬²¢¿ÉÒÔ¶ÔÊý¾Ý¿âmydb½øÐвéѯ¡¢²åÈë¡¢Ð޸ġ¢É¾³ýµÄ²Ù×÷
£¨localhostÖ¸±¾µØÖ÷»ú£¬¼´MYSQLÊý¾Ý¿âËùÔÚµÄÄÇ̨Ö÷»ú£©£¬ÕâÑùÓû§¼´Ê¹ÓÃÖªµÀtest2µÄÃÜÂ룬ËûÒ²ÎÞ·¨´ÓinternetÉÏÖ±½Ó·ÃÎÊÊý¾Ý
¿â£¬Ö»ÄÜͨ¹ýMYSQLÖ÷»úÉϵÄwebÒ³À´·ÃÎÊÁË¡£
grant select,insert,update,delete on mydb.* to test2@localhost identified by "abc";
Èç¹ûÄã²»Ïëtest2ÓÐÃÜÂ룬¿ÉÒÔÔÙ´òÒ»¸öÃüÁÃÜÂëÏûµô¡£
grant select,insert,update,delete on mydb.* to test2@localhost identified by "";
¶þ¡¢Êý¾Ý¿â²Ù×÷
1¡¢show databases; //ÁгöÊý¾Ý¿â
2¡¢use database_name //ʹÓÃdatabase_nameÊý¾Ý¿â
3¡¢create database data_name //´´½¨ÃûΪdata_nameµÄÊý¾Ý¿â
4¡¢drop database data_name //ɾ³ýÒ»¸öÃûΪdata_nameµÄÊý¾Ý¿â
Èý¡¢±í²Ù×÷
1¡¢show tables //ÁгöËùÓбí
create talbe tab_name(
id int(10) not null auto_increment primary key,
name varchar(40),
pwd varchar(40)
) charset=gb2312; ´´½¨Ò»¸öÃûΪtab_nameµÄбí
2¡¢drop table tab_name ɾ³ýÃûΪtab_nameµÄÊý¾Ý±í
3¡¢describe tab_name //ÏÔʾÃûΪtab_nameµÄ±íµÄÊý¾Ý½á¹¹
4¡¢show columns from tab_name //ͬÉÏ
5¡¢delete from tab_name //½«±ítab_nameÖеļǼÇå¿Õ
6¡¢select * from tab_name //ÏÔʾ±ítab_nameÖеļǼ
7¡¢mysqldump -uUSER -pPASSWORD --no-data DATABASE TABLE > table.sql //¸´ÖƱí½á¹¹
ËÄ¡¢Ð޸ıí½á¹¹
1¡¢ ALTER TABLE tab_name ADD PRIMARY KEY (col_name)
˵Ã÷£º¸ü¸Ä±íµÃµÄ¶¨Òå°Ñij¸öÀ¸Î»ÉèΪÖ÷¼ü¡£
2¡¢ALTER TABLE tab_name DROP PRIMARY KEY (col_name)
˵Ã÷£º°ÑÖ÷¼üµÄ¶¨Òåɾ³ý
3¡¢ alter table tab_name add col_name varchar(20); //ÔÚtab_name±íÖÐÔö¼ÓÒ»¸öÃûΪcol_nameµÄ×Ö¶ÎÇÒÀàÐÍΪvarchar(20)
4¡¢alter table tab_name drop col_name //ÔÚtab_nameÖн«col_na
Ïà¹ØÎĵµ£º
1.ʲôÊÇUDF? UDF(user-defined function)ÊÇmysqlΪÓû§ÌṩµÄ×Ô¶¨Ò庯ÊýµÄÀ©Õ¹½Ó¿Ú¡£Ëü±¾ÖÊÉϺÍmysqlÌṩµÄmax¡¢minºÍcountµÈº¯ÊýÀàËÆ¡£ 2.UDF¿ÉÒÔ×öʲô? UDFÊÇ×Ô¶¨Ò庯Êý£¬ËùÒÔËüÄÜ×öʲôÍêÈ«È¡¾öÓÚÄãµÄʵÏÖ¡£UDF¿ÉÒÔÔÚÆÕͨµÄsql¡¢triggerÒÔ¼°store procedure±»µ÷ÓᣠÈç¹û×Ô¶¨ÒåÒ»¸ötcp_send(ip,port,msg)µ ......
²Î¼û¹Ù·½²Î¿¼£¬µÚ25Õ£ºAPIºÍ¿â
25.2.3.49. mysql_ping()
int
mysql_ping(MYSQL *mysql)
ÃèÊö
¼ì²éÓë·þÎñÆ÷µÄÁ¬½ÓÊÇ·ñ¹¤×÷¡£Èç¹ûÁ¬½Ó¶ªÊ§£¬½«×Ô¶¯³¢ÊÔÔÙÁ¬½Ó¡£
¸Ãº¯Êý¿É±»ÏÐÖÃÁ˽ϳ¤Ê±¼äµÄ¿Í»§¶ËʹÓã¬ÓÃÒÔ¼ì²é·þÎñÆ÷ÊÇ·ñÒѹرÕÁËÁ¬½Ó£¬²¢ÔÚ±ØҪʱÔÙ´ÎÁ¬½Ó¡£
·µ»ØÖµ
Èç¹ûÓë·þÎñÆ÷µÄÁ¬½ÓÓÐЧ·µ»Ø ......
mysqlÀï×î³£ÓõÄÈÕÖ¾ÓÐ4ÖÖ,·Ö±ðÊÇ:´íÎóÈÕÖ¾,¶þ½øÖÆÈÕÖ¾,²éѯÈÕÖ¾ÒÔ¼°Âú²éѯÈÕÖ¾. 1.´íÎóÈÕÖ¾»á¼Ç¼µ±mysqlÆô¶¯ºÍ¹Ø±ÕÒÔ¼°ÔËÐÐÖеĴíÎóÐÅÏ¢,¿ÉÒÔʹÓà --log-error[=file_name]À´Ö¸¶¨´íÎóÈÕÖ¾´æ·ÅÎļþ.µ±mysql serverÒì³£µÄʱºòÓ¦¸ÃÊ×ÏȲ鿴¸ÃÈÕÖ¾.ÆäʵÀïÃæҲûʲô,ÎÒÓ¢ÓïËļ¶Ã»¹ý,ÅäÉÏ´Ê°ÔĿǰΪֹ»¹Ã»ÓÐÅöµ½½â¾ö²»Á˵ÄÎÊ ......
ÔÚÖ÷Íâ¼ü±í´æÔÚ¹ØϵµÄʱºòÈç¹û¼ÓÉÏ"lazy=true"µÄ»°£¬Ôò±íÃ÷ÑÓ³Ù£¬¼´Ö»²éѯÖ÷±íÖеÄÄÚÈÝ£¬¶ø²»²éѯÍâ¼ü±íÖеÄÄÚÈÝ¡£
Àý£º
<hibernate-mapping>
<class name="com.pojo.Sortp" table="sortp" catalog="shjdc">
<id name="id" type= ......
MysqlµÄ°²×°Îļþ¿ÉÒÔÖ±½Óµ½ http://www.mysql.com ÏÂÔØ£¬»ñµÃfor win32µÄ.zip°ü£¬½¨ÒéÑ¡Ôñ4.0.20d°æ±¾¡£
¡¡¡¡ÏÂÔØ»ñµÃMysqlµÄfor win32°²×°°üºó£¬ÓÃwinzip½âѹËõ£¬Ö±½ÓÔËÐÐsetup.exe£¬ÐèҪעÒâµÄÊÇÑ¡ÔñÒ»¸ö°²×°Â·¾¶£¬µ±È»£¬°²×°Â·¾¶¿ÉÒÔÈÎÒ⣬½¨ÒéÑ¡ÔñC:\MySQLĿ¼¡£°²×°Íê³ÉºóMySQLÒ²¾ÍÍê³ÉÁË¡£Ä¬ÈϵÄÓû§ÃûÊÇroot£¬ÃÜÂë ......