CÓïÑÔÁ¬½ÓMySQLÖÐÎÄÎÊÌâ
ÔÚѧϰ£¼Linux³ÌÐòÉè¼Æ£¾µÚ8ÕÂMySQLÊý¾Ý¿â8.3½Ú£º
ʹÓÃCÓïÑÔ·ÃÎÊMySQL·ÃÎÊÊý¾Ý¿âʱ³¢ÊÔ°ÑSQLÊý¾Ý»»³ÉÁËÖÐÎÄ£¬µ«ÊÇÔÚÔËÐÐʾÀý³ÌÐòʱÖÕ¶ËÊä³öÈ´ÂÒÂ룬MySQL C ÓïÑÔÁ¬½ÓĬÈÏ×Ö·û¼¯ÊÇlatin1
²éÁËÏÂAPIÕÒµ½ÈçϺ¯Êý¿É½â¾öÖÐÎÄÂÒÂëÎÊÌâ¡£
int
mysql_set_character_set(
MYSQL *
mysql,
char
*
csname)
ÃèÊö
¸Ãº¯ÊýÓÃÓÚΪµ±Ç°Á¬½ÓÉèÖÃĬÈϵÄ×Ö·û¼¯¡£×Ö·û´®csnameÖ¸¶¨ÁË1¸öÓÐЧµÄ×Ö·û¼¯Ãû³Æ¡£Á¬½ÓУ¶Ô³ÉΪ×Ö·û¼¯µÄĬÈÏУ¶Ô¡£¸Ãº¯ÊýµÄ¹¤×÷·½Ê½ÓëSET NAMESÓï¾äÀàËÆ£¬µ«Ëü»¹ÄÜÉèÖÃmysql-
>
charsetµÄÖµ£¬´Ó¶øÓ°ÏìÁËÓÉmysql_real_escape_string(
)
ÉèÖõÄ×Ö·û¼¯¡£
¸Ãº¯ÊýÊÇÔÚMySQL 5.
0.
7ÖÐÔö¼ÓµÄ¡£
·µ»ØÖµ
0±íʾ³É¹¦£¬·Ç0Öµ±íʾ³öÏÖ´íÎó¡£
ʾÀý£º
#
include
<
stdlib.
h>
#
include
<
stdio.
h>
#
include
"mysql.h"
MYSQL my_connection;
MYSQL_RES *
res_ptr;
MYSQL_ROW sqlrow;
void
display_row(
)
;
int
main(
int
argc,
char
*
argv[
]
)
{
int
res;
mysql_init(
&
my_connection)
;
if
(
mysql_real_connect(
&
my_connection,
"localhost"
,
"rick"
,
"secret"
,
"foo"
,
0,
NULL
,
0)
)
{
/* ÉèÖÃÊý¾Ý¿âĬÈÏ×Ö·û¼¯ */
if
(
mysql_set_character_set(
&
my_connection,
"utf8"
)
)
{
fprintf
(
stderr
,
"´íÎó, %s\n"
,
mysql_error(
&
my_connection)
)
;
}
res =
mysql_query(
&
my_connection,
"SELECT childno, fname, age from children WHERE age > 5"
)
;
if
(
res)
{
&nb
Ïà¹ØÎĵµ£º
//µ¼³ö
String mysql="mysqldump -uroot -proot --opt databasename > d:/test.sql";
java.lang.Runtime.getRuntime().exec("cmd /c "+mysql);
//µ¼Èë
String mysql="mysqladmin -uroot -proot create databasename";
java.lang.Runt ......
1¡¢±à¼MySQLÅäÖÃÎļþ£º
windows»·¾³ÖУº%MySQL_installdir%\my.ini¡¡//Ò»°ãÔÚMySQL°²×°Ä¿Â¼ÏÂÓÐmy.ini¼´MySQLµÄÅäÖÃÎļþ¡£
linux»·¾³ÖУº/etc/my.cnf
ÔÚ[MySQLd]ÅäÖöÎÌí¼ÓÈçÏÂÒ»ÐУº
skip-grant-tables
±£´æÍ˳ö±à¼¡£
2¡¢È»ºóÖØÆôMySQL·þÎñ
windows»·¾³ÖУº
net stop MySQL
net start MySQL
linux»·¾³ÖУº
/e ......
Ê×ÏȲ¹³äÏÂMySQLµÄ±íËøÎÊÌâ(Ò»)û½²µ½µÄϵͳ¿ÉÒÔͨ¹ýÉèÖÃmax_write_lock_count²ÎÊýÀ´¿ØÖÆдµÄÓÅÏȼ¶,µ±Ò»¸ö±íµÄ¶ÁËø´ïµ½Õâ¸öÊýµÄʱºò,MySQL»áÔÝʱµÄ,½µµÍдµÄÓÅÏȼ¶.MySQL¾¡Á¿ÉÙÓÃһЩ¿´Ëƾ«Ã¸´ÔÓµÄÓï¾ä,ÒòΪÄ㸴ÔÓ¿ÉÄܵ¼Ö¸ø±í¼ÓµÄ¶ÁËøʱ¼ä¾Í³¤,»áµ¼ÖÂдµÄ²Ù×÷ÎÞ·¨½øÐÐ. innodbºÍMyISAM×î´óµÄÇø±ðÔÚÓÚinnodbÖ§³ÖÊÂÎñ´¦ ......
http://hi.baidu.com/ubuntu2me/blog/item/e1bd54de9a428f1862279828.html
¡¾IT168¼¼ÊõÎĵµ
¡¿ÈκÎÒ»ÖÖÊý¾Ý¿âÖУ¬¶¼Óи÷ÖÖ¸÷ÑùµÄÈÕÖ¾¡£MysqlÒ²²»ÀýÍ⣬ÔÚMysqlÖÐÓÐ4ÖÖ²»Í¬µÄÈÕÖ¾¡¢·Ö±ð´íÎóÈÕÖ¾¡¢¶þ½øÖÆÈÕÖ¾¡¢²éѯÈÕÖ¾ºÍÂý²éѯÈÕÖ¾¡£ÕâЩÈÕÖ¾¼Ç¼×ÅMysqlÊý¾Ý¿â²»Í¬·½ÃæµÄ×Ù¼£¡£ÏÂÎĽ«½éÉÜÕâ4ÖÖ²»Í¬µÄÈÕÖ¾×÷ÓúÍÓÃ;¡£
¡¡¡ ......