Ubuntu 9.04 ÏÂMySQLÖÐÎÄÂÒÂëµÄ½â¾ö
Ubuntu 9.04 ÏÂÓÃÔ´°²×°ÁËMySQL¡£Ä¬ÈÏÇé¿öÏ£¬ÓÃmysql shellµÇ¼´´½¨Êý¾Ý¿â´´½¨±í²åÈëÖÐÎÄÊý¾Ýºó£¬ÓÃselect²é³öÀ´ÊÇÖÐÎÄ£¬µ«ÓÃJDBCÁ¬½Ó¾Í³öÏÖÂÒÂë¡£ÍøÉÏËÑË÷µ½½â¾ö·½·¨£¬ÈçÏ£¨Ïȱ¸·ÝÊý¾Ý£©£º
ÐÞ¸Ä/etc/mysql/my.cnf
sudo gedit /etc/mysql/my.cnf
ÔÚmy.cnfÎļþÖеÄ[client]¶ÎºÍ [mysqld]¶Î¼ÓÉÏÒÔÏÂÁ½ÐÐÄÚÈÝ£º
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8
ÐèÒªÖØÆômysql·þÎñ
Í£Óãº
sudo mysqladmin shutdown -u root -p
È»ºóÊäÈëmysqlµÄrootÓû§µÄÃÜÂë
ÆôÓãº
sudo mysqld_safe -user=mysql &
²é¿´Ò»ÏÂÏÖÔÚmysqlµÄ±àÂë
sudo mysql £u root -p
mysql>show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
ÏÖÔÚ²»¹ÜÔÚmysql shellÏ»¹ÊÇJDBC¶¼¿ÉÒÔÕý³£ÏÔʾÖÐÎÄÁË¡£µ«Ö®Ç°µÄÊý¾Ý»¹ÊDz»ÐУ¬ËùÒÔÔÚÕâ֮ǰµÃÏȱ¸·ÝÊý¾Ý£¬ÐÞ¸ÄÍê±àÂëºóÔÙµ¼Èë¡£
Ïà¹ØÎĵµ£º
mysqlÊý¾ÝÂÒÂëÎÊÌâÔÒò¼°½â¾ö£¨×ܽáƪ£©
µÚÒ»½â¾ö·½·¨£º
ÂÒÂëÎÊÌâ¼òµ¥Ëµ¾ÍÊÇÊý¾Ý¿âдÈë¶ÁÈ¡£¬ÍøÒ³Îļþ£¬ÍøÒ³ÏÔʾʱ¼¸¸ö»·½ÚµÄ±àÂë²»Ò»ÖÂÔì³ÉµÄ¡£
ÂÒÂëÎÊÌâ
дÈëʱ£ºÒ³ÃæÌáȡдÈëÊý¾Ý±àÂëºÍдÈëÊý¾Ý¿âʱ±àÂë²»Ò»ÖÂ
¶Áȡʱ£º¶ÁÈ¡ºóËùÓñàÂëÓëÊý¾Ý¿âдÈëʱ²»Ò»ÖÂ
......
¹ØÓÚÐÞ¸ÄmysqlµÄrootÃÜÂëµÄ½â´ð£¨×ܽáƪ£©
ÕûÀíÁËÒÔÏÂËÄÖÖÔÚMySQLÖÐÐÞ¸ÄrootÃÜÂëµÄ·½·¨,Ö÷ÒªÊÇÓÐʱºò×Ô¼ºÓöµ½ÁËÕâ¸öÎÊÌâ²»ÖªµÀÔõô¸ãÁË£¬µ±È»Èç¹ûÄܸø¹ã´óµÄPHPer½â¾öÎÊÌâÒ²ÊÇÎÒµÄÈÙÐÒ°¡£¬ºÇºÇ¡£
·½·¨1£º ÓÃSET PASSWORDÃüÁî
¡¡¡¡mysql -u root
¡¡¡¡mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('n ......
ÎÒÒ»Ö±ÊÇʹÓÃmysqlÕâ¸öÊý¾Ý¿âÈí¼þ£¬Ëü¹¤×÷±È½ÏÎȶ¨£¬Ð§ÂÊÒ²ºÜ¸ß¡£ÔÚÓöµ½ÑÏÖØÐÔÄÜÎÊÌâʱ£¬Ò»°ã¶¼ÓÐÕâô¼¸ÖÖ¿ÉÄÜ£º
1¡¢Ë÷ÒýûÓн¨ºÃ£»
2¡¢sqlд·¨¹ýÓÚ¸´ÔÓ£»
3¡¢ÅäÖôíÎó£»
4¡¢»úÆ÷ʵÔÚ¸ººÉ²»ÁË£»
1¡¢Ë÷ÒýûÓн¨ºÃ
Èç¹û¿´µ½mysqlÏûºÄµÄcpuºÜ´ó£¬¿ÉÒÔÓÃmysqlµÄclient¹¤¾ßÀ´¼ì²é¡£
ÔÚlinuxÏÂÖ´ÐÐ
/usr/local/mysql/bin/ ......
JDBCÁ¬½ÓMySQL
JDBCÁ¬½ÓMySQL
¼ÓÔؼ°×¢²áJDBCÇý¶¯³ÌÐò
Class.forName("com.mysql.jdbc.Driver");
Class.forName("com.mysql.jdbc.Driver").newInstance();
JDBC URL ¶¨ÒåÇý¶¯³ÌÐòÓëÊý¾ÝÔ´Ö®¼äµÄÁ¬½Ó
±ê×¼Óï·¨£º
<protocol£¨Ö÷ҪͨѶÐÒ飩>:<subprotocol£¨´ÎҪͨѶÐÒ飬¼´Çý¶¯³ÌÐòÃû³Æ£©>:<data so ......
mysqlÓÅ»¯£º ÄÚ´æ±íºÍÁÙʱ±í
2009Äê02ÔÂ01ÈÕ ÐÇÆÚÈÕ 10:41
ÓÉÓÚÖ±½ÓʹÓÃÁÙʱ±íÀ´´´½¨Öмä±í£¬ÆäËٶȲ»ÈçÈËÒ⣬Òò¶ø¾ÍÓÐÁË°ÑÁÙʱ±í½¨³ÉÄÚ´æ±íµÄÏë·¨¡£µ«ÄÚ´æ±íºÍÁÙʱ±íµÄÇø±ðÇÒ²¢²»ÊìϤ£¬ÐèÒª²éÕÒ×ÊÁÏÁË¡£
Ò»¿ªÊ¼ÒÔΪÁÙʱ±íÊÇ´´½¨ºó´æÔÚ£¬µ±Á¬½Ó¶Ï¿ªÊ±ÁÙʱ±í¾Í»á±»É¾³ý£¬¼´ÁÙʱ±íÊÇ´æÔÚÓÚ´ÅÅÌÉϵġ£¶øʵ¼Ê²Ù×÷Öз¢ÏÖÁÙÊ ......