perlÒ»¸ö¼òµ¥mysql²Ù×÷µÄС³ÌÐò
#!/usr/bin/perl
use Mysql;
print "Content-type:
text/html \n\n";
# MySQL
ÅäÖñäÁ¿
$host = "localhost";
$database
= "testdb";
$tablename = "testtable";
$user = "username";
$pw =
"password";
# PERL MYSQL CONNECT()
$connect = Mysql->connect($host,
$database, $user, $pw);
# SELECT
DB
$connect->selectdb($database);
# ¶¨ÒåMySQL²éѯ
$myquery = "INSERT
INTO
$tablename (id, product, quantity)
VALUES
(DEFAULT,'pineapples','15')";
# Ö´Ðвéѯ
$execute =
$connect->query($myquery);
# Ó°ÏìÐÐ
$affectedrows =
$execute->affectedrows($myquery);
# ×îºóÒ»¸öInsertµÄID
$lastid =
$execute->insertid($myquery);
print $affectedrows."<br
/>";
print $lastid."<br />";
Ïà¹ØÎĵµ£º
mysqlÉèÖÃÃÜÂëºÍÐÞ¸ÄÃÜÂ룺
/usr/local/mysql/bin/mysqladmin -uroot password 123456 µÚÒ»´ÎÉèÃÜÂë¡£
mysqladmin -uroot -p password mypasswd ÐÞ¸ÄÃÜÂë
ÊäÈëÕâ¸öÃüÁîºó£¬ÐèÒªÊäÈërootµÄÔÃÜÂ룬ȻºórootµÄÃÜÂ뽫¸ÄΪmypasswd¡£
¾ÍÊÇmysql5µ¼³öµÄÓÐdefault-charactµÄÉèÖã¬mysql4²»Ö§³Ö£¬ÐèÒª¼Óskip-opt²ÎÊý£¬È磺
my ......
Ò»:°²×°
ÎÞÂÛÄãϲ»¶µÄÊÇÄÄÖÖLINUXÌ×¼þ£¬Ëü¶¼ÓпÉÄÜ´øÓÐMySQL¡£Slackware,Ret Hat,SusEºÍDebianÖж¼ÔÚËüÃǵĵ±Ç°°æ±¾Öаüº¬ÁËËü£¬Õ⽫ÌṩһÖÖ×î¼òµ¥µÄ·½Ê½À´¿ìËÙ°²×°ºÍÔËÐÐMySQL¡£Èç¹ûÄãµÄ·¢Ðа汾ÖÐûÓÐÌṩMySQLÈí¼þ°ü£¬»òÕßÄãÏëµÃµ½×îеİ汾£¬Äã¿ÉÒÔ´ÓMySQLµÄÍøÕ¾:www.mysql.comÉÏÏÂÔضþ½øÖÆ°ü»òÔ ......
access denied for user 'root'@'localhost' (using password: YES);
½ñÌìÓÃmysqlµÄʱºò£¬µÇ¼µÄʱºò³öÏÖÁËÕâ¾ä£¬²»ÖªµÀÊÇʲôÒâ˼£¬ÒòΪÎÒµÄmysqlÊÇ×°centosµÄʱºòÒ»Æð×°µÄ£¬ÃÜÂëÎÒ¾ÍÊäÈëÎÒµÄÕÊ»§ÃÜÂ룬½á¹û³öÏÖÁËÉÏÃæÄǾ䣻°Ù¶ÈÁËһϣ¬»¹Õæ²»ÉÙÈ˳öÏÖÁËÕâ¸öÎÊÌâ¡£¡£×îºóÎÒÕÒµ½ÁË·½·¨£»
[root@localhost home]# mysql - ......
¡¾51CTO.com¶À¼ÒÌظ塿Ãæ¶Ô¾ª»ÅµÄ¿Í»§ºÍ¹ã·ºÖÊÒɵÄýÌ壬Oracle¹Ù·½×î½üÖÕÓÚ³ö°ñ°²Ãñ£¬ÄDZãÊÇÒ»¸öÒÔ“SUN CUSTOMERS ,Oracle Plans To£º”Ϊ´ó±êÌâµÄ¹ã¸æ¡£Ö±Òë¹ýÀ´±ã¹ýÀ´¿ÉÖªµÀ£¬Oracle½«Òª¼Ó´óSPARCºÍSolarisµÄͶÈëÁË£¬¶ø´óÀÏ°å°£ÀïÉÒ²ÏòIBMÓ²¼þÏÂÁËÕ½Ê飬Éù³ÆOracle½«×îÖÕÓ®µÃÕⳡ¾ºÕù……
&n ......
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%';
+--------------------------+--------------------------- ......