ÍùMYSQLÀïдÖÐÎľͱäÎʺţ¿
ÎÊÌâ½â¾öÁË£¬ÔÒòÊÇÔÚmy.cnfÖÐȱÉÙÁËÈçÏ´úÂ룺
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8
Èç¹û²»¼ÓÒÔÉÏ´úÂ룬ÄÇô¼´±ãMYSQL±àÒ밲װʱָ¶¨µÄ±àÂëÊÇUTF8£¬ÄÇôÔÚ½¨¿âʱÆäĬÈϱàÂëÈÔÊÇLATIN1£¬¶øÓÉÓÚ×Ö·û¼¯µÄ¼Ì³ÐÐÔ£¬¿âÖеıíÒ²ÊÇLATIN1µÄÁË¡£
ÕâÀïÁм¸ÌõÃüÁ´ó¼Ò¿ÉÒÔ×Ô¼ºÊÔÏ£º
1.ÁгöMYSQLÖ§³ÖµÄËùÓÐ×Ö·û¼¯£º
SHOW CHARACTER SET;
2.µ±Ç°MYSQL·þÎñÆ÷×Ö·û¼¯ÉèÖÃ
SHOW VARIABLES LIKE 'character_set_%';
3.µ±Ç°MYSQL·þÎñÆ÷×Ö·û¼¯Ð£ÑéÉèÖÃ
SHOW VARIABLES LIKE 'collation_%';
4.ÏÔʾijÊý¾Ý¿â×Ö·û¼¯ÉèÖÃ
show create database Êý¾Ý¿âÃû;
5.ÏÔʾijÊý¾Ý±í×Ö·û¼¯ÉèÖÃ
show create table ±íÃû;
6.ÐÞ¸ÄÊý¾Ý¿â×Ö·û¼¯
alter database Êý¾Ý¿âÃû default character set 'utf8';
7.ÐÞ¸ÄÊý¾Ý±í×Ö·û¼¯
alter table ±íÃû default character set 'utf8';
8.½¨¿âʱָ¶¨×Ö·û¼¯
create database Êý¾Ý¿âÃû character set gbk collate gbk_chinese_ci;
9.½¨±íʱָ¶¨×Ö·û¼¯
CREATE TABLE `mysqlcode` (
`id` TINYINT( 255 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`content` VARCHAR( 255 ) NOT NULL
) TYPE = MYISAM CHARACTER SET gbk COLLATE gbk_chinese_ci;
¸öÈËÈÏΪÒÔÉÏ·½·¨²»Ì«ºÃÓã¬Èç¹û¶¼²»ÐаÉÊý¾Ý¿â×ö±¸·Ý£¬Ö®ºóMySQL Server Instance ConfigÀォʵÀýɾÁËÖØн¨Ò»¸ö£¨Ö÷Òâ×Ö·û±àÂ룩£¬Èç¹û»¹²»ÐÐÖØ×°Mysql£¨Ð¶ÔØmysqlʱҪעÒ⣬·Ç³£¸´ÔÓ£¬¾ßÌå·½·¨ÎÒ·ÖÏíÁË£©
Ïà¹ØÎĵµ£º
½ñÌìµ½mysqlÍøÕ¾¿´¿´·¢ÏÖûÓÐÁËsun LOGO£¬Ò²ÕÒ²»µ½mysql downloadsÏÂÔØÁ´½Ó
ÒªÊÖ¹¤´òÈëhttp://dev.mysql.com²ÅÐУ¬²»½ûÉÁ¹ýһ˿Á¹Ò⣬ÒÔÇ°¼á³ÖʹÓÃmysqlÏÖÔÚ»¹Òª¼á³ÖÂð£¬
ÒÔÇ°ÐÄÀïÒ»Ö±ÔÚÏëÒ»Ö±»áʹÓÃmysqlµÄ£¬µ«ÊÇÏÖÔڸоõµ½ºÜʧÍû£¬´ìÕÛ£¬½¹ÂÇ£¬²»ÖªÒÔºó»áÔõôÑù
×Ô¼º¼¸ÄêÀ´Ò»Ö±Ê¹ÓÃLAMP×éºÏ£¬ÖªÊ¶¶¼ÊÇÊÇΧÈÆ×ÅÕâ¸ö×éºÏ ......
PHPÊÖ²áÉÏÌṩÁËÒÔÏÂһЩÖ÷ÒªµÄmysqlÊý¾Ý¿âµÄÖ§³Öº¯Êý£º
mysql_affected_rows -- È¡µÃÇ°Ò»´Î MySQL ²Ù×÷ËùÓ°ÏìµÄ¼Ç¼ÐÐÊý
mysql_change_user -- ¸Ä±ä»î¶¯Á¬½ÓÖеǼµÄÓû§
mysql_client_encoding -- ·µ»Ø×Ö·û¼¯µÄÃû³Æ
mysql_close -- ¹Ø±Õ MySQL Á¬½Ó
mysql_connect -- ´ò¿ªÒ»¸öµ½ MySQL ·þÎñÆ÷µÄÁ¬½Ó
mysql_c ......
×î½üÁ˽âÁËÒ»ÏÂMYSQL×¢È룬Ҳʵ¼Ê²Ù×÷ÁËһϣ¬È·Êµ·¢ÏÖÁËËûµÄÍþÁ¦¡£
Ò»¸ö×¢È멶´¿ÉÒÔÈÃÈËÖ±½ÓÄõ½·þÎñÆ÷ȨÏÞ¡£
×ܽáһϣº
1£¬Ä¿Â¼µÄȨÏÞ²»ÄÜÌ«¸ß£¬²»È»±ðÈËÄÜÍùÀïдÎļþ£¬ÒÔÇ°ÓÃ0777ÕæÊÇÌ«ÓÞ´ÀÁË¡£
2£¬Ñϸñ¹ýÂËÊý¾Ý£¬ÕûÐÎÒ»ÂÉתint»òÓÃmysql_escape_string
3£¬ÉèÖúÏÀíµÄÊý¾Ý¿âȨÏÞ£¬²»ÒªÓÃROOT,²»È»»áËÀµÃºÜ²Ò¡£
4 ......
1¡¢MySQL³£ÓÃÃüÁî
create database name; ´´½¨Êý¾Ý¿â
use databasename; Ñ¡ÔñÊý¾Ý¿â
drop database name Ö±½Óɾ³ýÊý¾Ý¿â£¬²»ÌáÐÑ
show tables; ÏÔʾ±í
describe tablename; ±íµÄÏêϸÃèÊö
select ÖмÓÉÏdistinctÈ¥³ýÖظ´×Ö¶Î
mysqladmin drop databasename ɾ³ýÊý¾Ý¿âÇ°£¬ÓÐÌáʾ¡£
ÏÔʾµ±Ç°mysql°æ±¾ºÍµ±Ç°È ......
MySQL°²×°Íê³Éºó²»ÏóSQL ServerĬÈÏ°²×°ÔÚÒ»¸öĿ¼£¬ËüµÄÊý¾Ý¿âÎļþ¡¢ÅäÖÃÎļþºÍÃüÁîÎļþ·Ö±ðÔÚ²»Í¬µÄĿ¼£¬Á˽âÕâЩĿ¼·Ç³£ÖØÒª£¬ÓÈÆä¶ÔÓÚLinuxµÄ³õѧÕߣ¬ÒòΪ Linux±¾ÉíµÄĿ¼½á¹¹¾Í±È½Ï¸´ÔÓ£¬Èç¹û¸ã²»Çå³þMySQLµÄ°²×°Ä¿Â¼ÄǾÍÎÞ´Ó̸ÆðÉîÈëѧϰ¡£ÏÂÃæ¾Í½éÉÜÒ»ÏÂÕ⼸¸öĿ¼¡£
£¨1£©Êý¾Ý¿âĿ¼
......