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Óкܶà¿ÉÒÔµ¼ÈëÊý¾ÝµÄ·½·¨£¬È»¶øÕâЩֻÊÇÊý¾Ý´«ÊäÖеÄÒ»°ë£¬ÁíÍâµÄÒ»°ãÊÇ´ÓMySQLÊý¾Ý¿âÖе¼³öÊý¾Ý¡£ÓÐÐí¶àµÄÔÒòÎÒÃÇÐèÒªµ¼³öÊý¾Ý¡£Ò»¸öÖØ
ÒªµÄÔÒòÊÇÓÃÓÚ±¸·ÝÊý¾Ý¿â¡£Êý¾ÝµÄÔì¼Û³£³£ÊÇ°º¹óµÄ£¬ÐèÒª½÷É÷´¦ÀíËüÃÇ¡£¾³£µØ±¸·Ý¿ÉÒÔ°ïÖú·ÀÖ¹±¦¹óÊý¾ÝµØ¶ªÊ§£»ÁíÍâÒ»¸öÔÒòÊÇ£¬Ò²ÐíÄúÏ£Íûµ¼³öÊý¾ÝÀ´¹²
Ïí¡£ ÔÚÕâ¸öÐÅÏ¢¼¼Ê ......
MySQLÅäÖÃÎļþ
MySQL·¢²¼µÄ×îвúƷʵ¼ÊÉϳ¬³öÁËLinuxËùЯ´øµÄ°æ±¾¡£µ«ÊÇ£¬Îȶ¨ÐԺͿª·ÅÔ´´úÂë¿ÉÊǺÜÖØÒªµÄÒòËØ£¬Òò´ËÔÚ²Ù×÷ϵͳÉÏʹÓýÏÔçMySQL°æ±¾ÊÇÓеÀÀíµÄ¡£
ÓÐÐí¶à¿ÉÒÔ²ÉÓõÄÅäÖÃÎļþ£¬ËüÃǶ¼±»°üº¬ÔÚmysql-server PRM³ÌÐòÖС£»¹ÓÐÒ»¸öĬÈϵÄÅäÖÃÎļþ±»°üº¬ÔÚmysql PRM³ÌÐò°üÖС£
ÅäÖÃMySQL·þÎñÆ÷ÊÇÒ»¸ö·á¸»¶ø¸´ÔÓ ......
1¡¢½âѹ mysql-noinstall-5.1.30-win32.zip
2¡¢ÔÚ F Å̽¨Á¢Ä¿Â¼ MySql\MySqlServer5.1\
3¡¢°Ñ½âѹµÄÄÚÈݸ´ÖƵ½ F:\MySql\MySqlServer5.1\
4¡¢ÔÚ F:\MySql\MySqlServer5.1\ ÖÐÕÒ my-large.ini °ÑËü¸´ÖÆ³É my.ini
5¡¢ÔÚ my.ini ÖÐÕÒ [mysqld] £¬Ìí¼ÓÒÔÏÂÓï¾ä;
basedir="F:/MySql/MySqlServer5.1/"
datadir="F:/My ......