Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : mysql

²é¿´MySQL¼Ç¼ִÐйýµÄSQL

µÚÒ»ÖÖ:²éSlow queryµÄSQLÓï·¨:
 
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 2 (³¬¹ý2ÃëµÄSQLÓï·¨¼Ç¼ÆðÀ´,Éè¶ÌÒ»µãÀ´¼Ç¼³ý´íÒ²ÊÇÒ»ÖÖ·½·¨.)
 
µÚ¶þÖÖ:ÉèMySQL ReplicationÓÃbinlog:
 
log_bin = /var/log/mysql/mysql-bin.log (´ËµµÒªÓÃmysqlbinlog½âÀ´¿´£¬
mysqlbinlog mysql-bin.000042| grep "T_ABC" | grep "column value"
)
 
mysql»á½«ËùÓÐINSERT/UPDATE/DELETEÓï·¨¼ÇÓÚ´Ë(µ«ÊÇÓï·¨¿ÉÄܸúÄãÏëµÄ²»Í¬),ÕâÊÇҪд¸øSLAVEÓõÄlog Îļþ
 
µÚÈýÖÖ:ÍƼö´Ë·½·¨,½«MySQLÖ´ÐеÄÿÐÐÖ¸ÁîÈ«¶¼¼Ç¼ÆðÀ´:
 
log = /tmp/mysql.log
restart mysqlºó, tail -f /tmp/mysql.log¾Í¿ÉÒÔ¿´µ½ ......

´î½¨JSP ×éºÏMyEclipse£«MySQL£«Tomcat¿ª·¢»·¾³

Ò»¡¢°²×°JDK ¡¡¡¡Ê×ÏÈÏÂÔØJDK 5.0£¨JDK 5.0µÄÏÂÔØÒ³ÃæΪ£ºhttp://java.sun.com/j2se/1.5.0/download.jsp£©£» È»ºóÔËÐÐJDK 5.0°²×°³ÌÐòjdk-1_5_0_06-windows-i586-p.exe£¬°²×°¹ý³ÌÖÐËùÓÐÑ¡Ïî±£³ÖĬÈÏ£»×îºóÅäÖÃJDKµÄ»·¾³±äÁ¿£ºÔÚ“ÎҵĵçÄÔ”ÉϵãÓÒ¼ü—>“ÊôÐÔ”—>“¸ß¼¶”—> “»·¾³±äÁ¿(N)”¡£ ¡¡¡¡Ð½¨ÏµÍ³±äÁ¿JAVA_HOME£ºC:\Program Files\Java\jdk1.5.0_06£» ¡¡¡¡Ð½¨ÏµÍ³±äÁ¿CLASSPATH£º.;%JAVA_HOME%\lib;£¨×¢Ò⣺µãºÅ±íʾµ±Ç°Ä¿Â¼£¬²»ÄÜÊ¡ÂÔ£© ¡¡¡¡ÔÚϵͳ±äÁ¿PathµÄÖµµÄÇ°Ãæ¼ÓÈëÒÔÏÂÄÚÈÝ£º%JAVA_HOME%\bin;(×¢Òâ:ÕâÀïµÄ·ÖºÅ²»ÄÜÊ¡ÂÔ) ¡¡¡¡µ½ÕâÀJDK°²×°Íê±Ï¡£ ¡¡¡¡ÏÂÃæÎÒÃDzâÊÔÒ»ÏÂJDKÊÇ·ñ°²×°³É¹¦£º ¡¡¡¡½«ÒÔÏÂÄÚÈݸ´ÖƵ½¼Çʱ¾ÖУº public class HelloJAVA { public static void main(String srg[]) { System.out.println("Hello JAVA!"); } } ¡¡¡¡Áí´æΪ“HelloJAVA.java”£¨²»º¬ÒýºÅ£¬ÏÂͬ£©£¬²¢±£´æµ½DÅ̸ùĿ¼Ï¡£ ¡¡¡¡ÔÚÃüÁîÐÐÒÀ´ÎÊäÈëÏÂͼÖкìÏßËù±ê×¢µÄÃüÁ ¡¡¡¡Èç¹û³öÏÖÉÏͼºì¿òÖÐËù±ê×¢µÄÄÚÈÝ£¬Ôò˵Ã÷JDK°²×°³É¹¦£¡ ¡¡¡¡×¢Òâ:Èç¹ûÒÔºóÒª°²×°ÖîÈçEclipse¡¢Borland JBuilder ......

´î½¨JSP ×éºÏMyEclipse£«MySQL£«Tomcat¿ª·¢»·¾³

Ò»¡¢°²×°JDK ¡¡¡¡Ê×ÏÈÏÂÔØJDK 5.0£¨JDK 5.0µÄÏÂÔØÒ³ÃæΪ£ºhttp://java.sun.com/j2se/1.5.0/download.jsp£©£» È»ºóÔËÐÐJDK 5.0°²×°³ÌÐòjdk-1_5_0_06-windows-i586-p.exe£¬°²×°¹ý³ÌÖÐËùÓÐÑ¡Ïî±£³ÖĬÈÏ£»×îºóÅäÖÃJDKµÄ»·¾³±äÁ¿£ºÔÚ“ÎҵĵçÄÔ”ÉϵãÓÒ¼ü—>“ÊôÐÔ”—>“¸ß¼¶”—> “»·¾³±äÁ¿(N)”¡£ ¡¡¡¡Ð½¨ÏµÍ³±äÁ¿JAVA_HOME£ºC:\Program Files\Java\jdk1.5.0_06£» ¡¡¡¡Ð½¨ÏµÍ³±äÁ¿CLASSPATH£º.;%JAVA_HOME%\lib;£¨×¢Ò⣺µãºÅ±íʾµ±Ç°Ä¿Â¼£¬²»ÄÜÊ¡ÂÔ£© ¡¡¡¡ÔÚϵͳ±äÁ¿PathµÄÖµµÄÇ°Ãæ¼ÓÈëÒÔÏÂÄÚÈÝ£º%JAVA_HOME%\bin;(×¢Òâ:ÕâÀïµÄ·ÖºÅ²»ÄÜÊ¡ÂÔ) ¡¡¡¡µ½ÕâÀJDK°²×°Íê±Ï¡£ ¡¡¡¡ÏÂÃæÎÒÃDzâÊÔÒ»ÏÂJDKÊÇ·ñ°²×°³É¹¦£º ¡¡¡¡½«ÒÔÏÂÄÚÈݸ´ÖƵ½¼Çʱ¾ÖУº public class HelloJAVA { public static void main(String srg[]) { System.out.println("Hello JAVA!"); } } ¡¡¡¡Áí´æΪ“HelloJAVA.java”£¨²»º¬ÒýºÅ£¬ÏÂͬ£©£¬²¢±£´æµ½DÅ̸ùĿ¼Ï¡£ ¡¡¡¡ÔÚÃüÁîÐÐÒÀ´ÎÊäÈëÏÂͼÖкìÏßËù±ê×¢µÄÃüÁ ¡¡¡¡Èç¹û³öÏÖÉÏͼºì¿òÖÐËù±ê×¢µÄÄÚÈÝ£¬Ôò˵Ã÷JDK°²×°³É¹¦£¡ ¡¡¡¡×¢Òâ:Èç¹ûÒÔºóÒª°²×°ÖîÈçEclipse¡¢Borland JBuilder ......

Éý¼¶mysqlÊý¾Ý¿âµÄ·½·¨

Éý¼¶mysqlÊý¾Ý¿âµÄ·½·¨£º
1.         ÏÂÔØ°²×°½éÖÊmysql-essential-5.1.46-win32.msi
¿ÉÒÔµ½¹ÙÍøhttp://www.mysql.com/click.php?e=35166»òÆäËûÍøվȥÏÂÔØ£»
2.         ±¸·ÝmysqlµÄÊý¾Ý£»
ÔËÐÐcmd´ò¿ªÃüÁîÌáʾ·û£¬½øÈëµ½mysqlÈí¼þµÄbinĿ¼ÏÂͨ¹ýmysqldumpÃüÁî½øÐб¸·Ý£»
C:\mysql\bin>mysqldump -uroot -p -c -Q --add-drop-table --default-character-set=gb2312 ipmngr > D:\db20100525backup.sql
Enter password:£¨ÊäÈëÃÜÂëÒ»°ãÃÜÂëΪ¿ÕÖ±½Ó»Ø³µ¼´¿É£©
Êý¾Ý¿âÖеÄÐÅÏ¢»áµ¼Èëdb20100525backup.sqlÎļþÖУ»
ÔËÐÐservices.msc´ò¿ª·þÎñ´°¿Ú£¬Í£Ö¹µô¾ÉmysqlµÄ·þÎñ¡£ÎªÁË·ÀÖ¹Éý¼¶Êý¾Ý¿âʧ°Ü±ãÓÚ»Ö¸´£¬ÎÒ»¹¶ÔÎļþ¿½±´×öÁ˸öÓ²±¸·Ý±ãÓÚ»Ö¸´£»
¸´ÖÆmysqlÈí¼þµÄĿ¼£¬Õ³Ìùµ½±£´æµÄĿ¼Ï£»
±¸·ÝÍê±Ï£»
3.         жÔؾɵÄmysqlÈí¼þ£¬¶ÀÁ¢mysql°²×°°ü°²×°µÄÔËÐÐappwiz.cplжÔØmysqlÈí¼þ£»
¼ò»¯°²×°°ü°²×°µÄÔËÐÐappwiz.cplжÔØipaddr managementÈí¼þ£»
ÒªÏë³¹µ×жÔظɾ»£¬»¹¸øɾ³ý֮ǰmysqlÈí¼þµÄÏà¹ØĿ¼£»
ÔËÐÐregedit´Ó×¢²á±íÖÐË ......

MySQL³£ÓÃÃüÁî

µÚÒ»ÕС¢mysql·þÎñµÄÆô¶¯ºÍÍ£Ö¹
net stop mysql
net start mysql
µÚ¶þÕС¢µÇ½mysql
Óï·¨ÈçÏ£º mysql -uÓû§Ãû -pÓû§ÃÜÂë
¼üÈëÃüÁîmysql -uroot -p£¬ »Ø³µºóÌáʾÄãÊäÈëÃÜÂ룬ÊäÈë12345£¬È»ºó»Ø³µ¼´¿É½øÈëµ½mysqlÖÐÁË£¬mysqlµÄÌáʾ·ûÊÇ£º
mysql>
×¢Ò⣬Èç¹ûÊÇÁ¬½Óµ½ÁíÍâµÄ»úÆ÷ÉÏ£¬ÔòÐèÒª¼ÓÈëÒ»¸ö²ÎÊý-h»úÆ÷IP
µÚÈýÕС¢Ôö¼ÓÐÂÓû§
¸ñʽ£ºgrant ȨÏÞ on Êý¾Ý¿â.* to Óû§Ãû@µÇ¼Ö÷»ú identified by "ÃÜÂë"
È磬Ôö¼ÓÒ»¸öÓû§user1ÃÜÂëΪpassword1£¬ÈÃÆä¿ÉÒÔÔÚ±¾»úÉϵǼ£¬ ²¢¶ÔËùÓÐÊý¾Ý¿âÓвéѯ¡¢²åÈë¡¢Ð޸ġ¢É¾³ýµÄȨÏÞ¡£Ê×ÏÈÓÃÒÔrootÓû§Á¬Èëmysql£¬È»ºó¼üÈëÒÔÏÂÃüÁ
grant select,insert,update,delete on *.* to user1@localhost Identified by "password1";
Èç¹ûÏ£Íû¸ÃÓû§Äܹ»ÔÚÈκλúÆ÷Éϵǽmysql£¬Ôò½«localhost¸ÄΪ"%"¡£
Èç¹ûÄã²»Ïëuser1ÓÐÃÜÂ룬¿ÉÒÔÔÙ´òÒ»¸öÃüÁÃÜÂëÈ¥µô¡£
grant select,insert,update,delete on mydb.* to user1@localhost identified by "";
µÚËÄÕУº ²Ù×÷Êý¾Ý¿â
µÇ¼µ½mysqlÖУ¬È»ºóÔÚmysqlµÄÌáʾ·ûÏÂÔËÐÐÏÂÁÐÃüÁÿ¸öÃüÁîÒԷֺŽáÊø¡£
1¡¢ ÏÔʾÊý¾Ý¿âÁÐ±í¡£
show databases;
ȱʡÓÐÁ½¸öÊý¾Ý¿â£ºmysqlºÍtest¡£ mysql ......

ͨ¹ýSAS fastload Mysql table µ½ Teradata

/*clear fastload tables*/
%let gdw_dir =( user="XXXXX" password="XXXXX" database="XXXXX" tdpid="XXXXX");
proc sql;
connect to teradata as TD &gdw_dir;
execute (drop table STG_MYSQL_lkp_verticals)
by TD;
execute (commit) by TD;
disconnect from TD;
quit;
proc sql;
connect to teradata as TD &gdw_dir;
execute (drop table append_err1)
by TD;
execute (commit) by TD;
disconnect from TD;
quit;
proc sql;
connect to teradata as TD &gdw_dir;
execute (drop table append_err2)
by TD;
execute (commit) by TD;
disconnect from TD;
quit;
proc sql;
connect to teradata as TD &gdw_dir;
execute
(
create table STG_MYSQL_lkp_verticals
(
vertical varchar(10),
category_id integer,
category_name varchar(70),
short_name varchar(70)
)primary index ......

MySqlÃüÁî´óÈ«

1. Á¬½Ómysql:
mysqlbinmysql -hÖ÷»úµØÖ· -u Óû§Ãû £­p Óû§ÃÜÂë
2.Í˳ömysql:exit
3. ÐÞ¸ÄÃÜÂë:
mysqlbinmysqladmin -uroot -p(oldpassword) password newpassword
4.Ôö¼ÓÓû§£º
Ìí¼ÓÒ»¸öÓû§test1 ÃÜÂëΪABC£»ÈÃËû¿ÉÒÔÔÚÈκÎÖ÷»úÉϵǼ,²¢¶ÔËùÓÐÊý¾Ý¿âÓвéѯ¡¢²åÈë¡¢Ð޸ġ¢É¾³ýµÄȨÏÞ¡£Ê×ÏÈÓÃÒÔrootÓû§Á¬Èë
mysql,È»ºó¼üÈëÒÔÏÂÃüÁgrant select,insert,update,delete on *.* to test1@"%" Identified
by "abc";
Ôö¼ÓÒ»¸öÓû§test2ÃÜÂëΪabc,ÈÃÆäÖ»¿ÉÒÔÔÚlocalhostÉϵǼ,²¢¿ÉÒÔ¶ÔÊý¾Ý¿âmydb½øÐвéѯ¡¢²åÈë¡¢Ð޸ġ¢É¾³ýµÄ²Ù×÷£¨localhostÖ¸±¾µØ
Ö÷»ú,¼´mysqlÊý¾Ý¿âËùÔÚµÄÄÇ̨Ö÷»ú£©,ÕâÑùÓû§¼´Ê¹ÓÃÖªµÀtest2µÄÃÜÂ룬ҲÎÞ·¨´ÓinternetÉÏÖ±½Ó·ÃÎÊÊý¾Ý¿â,Ö»ÄÜͨ¹ýmysqlÖ÷»úÉϵÄwebÒ³
À´·ÃÎÊÁË¡£grant select,insert,update,delete on mydb.* to test2@localhost identified by "abc";
Ôö¼ÓÒ»¸ö¿ÉÒÔ´ÓÈκεط½Á¬½Ó·þÎñÆ÷µÄÒ»¸öÍêÈ«µÄ³¬¼¶Óû§
grant all privileges on *.* to test3@"%" identified by 'password' with grant option;
5.ɾ³ýÊÚȨ
revoke select,insert,update,delete om *.* from test2@localhost ;
-------------------------------------- ......
×ܼǼÊý:2220; ×ÜÒ³Êý:370; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [11] [12] [13] [14] 15 [16] [17] [18] [19] [20]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ