請(qǐng)您首先下載PhpMyAdmin軟件,將此文件包解壓,找到其中的一個(gè)文件:
config.inc.php(或者如config.*等, 該文件名會(huì)因phpmyadmin版本不同, 而有所差別)
修改以下配置:
$cfgServers[1]['host'] = 'localhost'; // MySQL hostname
$cfgServers[1]['port'] = ''; // MySQL port - leave blank for default port
$cfgServers[1]['socket'] = ''; // Path to the socket - leave blank for default socket
$cfgServers[1]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket')
$cfgServers[1]['stduser'] = ''; // MySQL standard user settings (this user must have read-only
$cfgServers[1]['stdpass'] = ''; // access to the "mysql/user" and "mysql/db" tables)
$cfgServers[1]['adv_auth'] = FALSE; // Use advanced authentication?
$cfgServers[1]['user'] = '數(shù)據(jù)庫(kù)登陸用戶名稱'; // MySQL user
$cfgServers[1]['password'] = '您的mysql連接密碼'; // MySQL password (only needed with basic auth)
$cfgServers[1]['only_db'] = '數(shù)據(jù)庫(kù)名稱'; // If set to a db-name, only this db is displayed at left frame
然后您ftp到您的網(wǎng)站, 在wwwroot下建立一個(gè)目錄phpmyadmin, 把phpmyadmin所有文件上傳到該目錄下
訪問http://您的網(wǎng)站/phpmyadmin, 即可管理您的數(shù)據(jù)庫(kù)了.
在您建好您的數(shù)據(jù)庫(kù)后, 記得把這些phpadmin的文件移走, 否則便讓任何人都可以管理您的數(shù)據(jù)庫(kù)了.
您如果用php編程, 可以用以下代碼連接數(shù)據(jù)庫(kù):
$database = "數(shù)據(jù)庫(kù)名稱";
$user = "數(shù)據(jù)庫(kù)登陸用戶名稱";
$password = "您的mysql連接密碼";
$link = mysql_connect ("localhost", $user, $password)
or die ("Could not connect");
mysql_select_db($database, $link);
..........
mysql_close ($link);
?>
您如果用perl編程, 可以用如下代碼連接數(shù)據(jù)庫(kù):
#!/usr/bin/perl
use DBI;
$database = "數(shù)據(jù)庫(kù)名稱";
$user = "數(shù)據(jù)庫(kù)登陸用戶名稱";
$password = "您的mysql連接密碼";
$dbh = DBI->connect("DBI:mysql:$database", $user, $password);
..........
$rc = $dbh->disconnect;
|