Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

jdbc Óë mysqlÁ¬½Ó

JDBCÁ¬½ÓMySQL
JDBCÁ¬½ÓMySQL
¼ÓÔؼ°×¢²áJDBCÇý¶¯³ÌÐò
Class.forName("com.mysql.jdbc.Driver");
Class.forName("com.mysql.jdbc.Driver").newInstance();
JDBC URL ¶¨ÒåÇý¶¯³ÌÐòÓëÊý¾ÝÔ´Ö®¼äµÄÁ¬½Ó
±ê×¼Óï·¨£º
<protocol£¨Ö÷ҪͨѶЭÒ飩>:<subprotocol£¨´ÎҪͨѶЭÒ飬¼´Çý¶¯³ÌÐòÃû³Æ£©>:<data source identifier£¨Êý¾ÝÔ´£©>
MySQLµÄJDBC URL¸ñʽ£º
jdbc:mysql//[hostname][:port]/[dbname][?param1=value1][&param2=value2]….
 
ʾÀý£ºjdbc:mysql://localhost:3306/sample_db?user=root&password=your_password
 
³£¼û²ÎÊý£º
user                       Óû§Ãû
password                  ÃÜÂë
autoReconnect                  Áª»úʧ°Ü£¬ÊÇ·ñÖØÐÂÁª»ú£¨true/false£©
maxReconnect              ³¢ÊÔÖØÐÂÁª»ú´ÎÊý
initialTimeout               ³¢ÊÔÖØÐÂÁª»ú¼ä¸ô
maxRows                   ´«»Ø×î´óÐÐÊý
useUnicode                 ÊÇ·ñʹÓÃUnicode×ÖÌå±àÂ루true/false£©
characterEncoding          ºÎÖÖ±àÂ루GB2312/UTF-8/…£©
relaxAutocommit            ÊÇ·ñ×Ô¶¯Ìá½»£¨true/false£©
capitalizeTypeNames        Êý¾Ý¶¨ÒåµÄÃû³ÆÒÔ´óд±íʾ
½¨Á¢Á¬½Ó¶ÔÏó
String url="jdbc:mysql://localhost:3306/sample_db?user=root&password=your_password";
Connection con = DriverManager.getConnection(url);
½¨Á¢SQL³ÂÊöʽ¶ÔÏó£¨Statement Object£©
Statement stmt = con.createStatem


Ïà¹ØÎĵµ£º

Mysql UTF8 ½â¾öÂÒÂë

1£¬ÉèÖÃmysqlĬÈϱàÂë
Ê×ÏȲéѯһÏÂshow variables like 'character%'; 
È·¶¨ËùÓеÄcharacter¶¼ÉèÖóÉutf-8  
²Î¿¼ http://www.diybl.com/course/7_databases/mysql/myxl/20081127/152726.html
mysql>show variables like 'character%';
+--------------------------+--------------------------- ......

UbuntuÖÐ Mysql Ô¶³ÌµÇ¼µÄ½â¾ö·½·¨

mysql>use mysql;
mysql>update user set host='%' where user='root';
ÖØÆôMysql
sudo /etc/init.d/mysql restart
[sudo] password for wangzw:
*Stopping MySQL database server mysqld                   & ......

MYSQLÍü¼ÇROOTÃÜÂëºó£¿

 
 MYSQLÍü¼ÇROOTÃÜÂëºó£¿
 
ÐÞ¸ÄMySQLµÄµÇ¼ÉèÖãº
1.È¡ÏûȨÏÞ¹ÜÀí
±à¼­ /mysql5.1/my.ini
ÔÚ[mysqld]µÄ¶ÎÖмÓÉÏÒ»¾ä£ºskip-grant-tables
ÀýÈ磺
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-name-resolve
skip-grant-tables
Ä¿µÄÊÇΪÁË£º
Ìø¹ýMySQLµÄ·ÃÎ ......

mysql,sqlserver,oracleÈýÖÖÊý¾Ý¿âµÄ´ó¶ÔÏó´æÈ¡

mysql ´ó¶ÔÏó´æÈ¡:
¡¡¡¡ÀàÐÍÒ»°ãÓ¦¸ÃÓÃmediumblod,
¡¡¡¡blobÖ»ÄÜ´æ2µÄ16´Î·½¸öbyte,
¡¡¡¡mediumblodÊÇ24´Î·½,
¡¡¡¡Ò»°ãÀ´Ëµ¹»ÓÃÁË.longblobÊÇ32´Î·½ÓÐЩ´ó.
¡¡¡¡MYSQLĬÈÏÅäÖÃÖ»ÄÜ´æ1M´óСµÄÎļþ,ÒªÐÞ¸ÄÅäÖÃ,WIN°æ±¾µÄÔÚmysql.iniÎļþÖÐ
¡¡¡¡ÐÞ¸Ämax_allowed_packet,net_buffer_lengthµÈ¼¸¸ö²ÎÊý,»òÖ±½ÓSET GLOBAL va ......

MySql³£ÓÃÃüÁî

MySQL³£ÓòÙ×÷»ù±¾²Ù×÷£¬ÒÔ϶¼ÊÇMySQL5.0ϲâÊÔͨ¹ýÊ×ÏÈ˵Ã÷Ï£¬¼ÇסÔÚÿ¸öÃüÁî½áÊøʱ¼ÓÉÏ£»£¨·ÖºÅ£©
1.µ¼³öÕû¸öÊý¾Ý¿â
mysqldump -u Óû§Ãû -p --default-character-set=latin1 Êý¾Ý¿âÃû > µ¼³öµÄÎļþÃû(Êý¾Ý¿âĬÈϱàÂëÊÇlatin1)
mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql
2.µ¼³öÒ»¸ö±í
mysqldump -u Ó ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ