mysql怎么選擇多個(gè)數(shù)據(jù)庫(kù)?
1 回答

HUH函數(shù)
TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超4個(gè)贊
mysql操作多個(gè)數(shù)據(jù)庫(kù),需要在程序中切換,更改主機(jī)ip和端口以及連接的db名就可以了。
比如:
連接db1:
$connn=mysql_connect("localhost","root","root");
mysql_select_db("changtong",$connn);
mysql_query("set names gb2312");
連接db2:
$connn=mysql_connect("localhost1","root1","root1");
mysql_select_db("jiangshe",$connn);
這樣就可以同時(shí)操作連個(gè)數(shù)據(jù)庫(kù)了。
添加回答
舉報(bào)
0/150
提交
取消