email.txt的路徑是上傳文本每行文件到我已經email.txt存儲在我的服務器的MySQL行
/home/xxxx/public_htnl/email.txt
email.txt由用戶的幾千電子郵件這每天得到更新。 我想使用cron將這些電子郵件每日導入其他數據庫。
我試過這個,但它給出的錯誤
無法加載。 Access denied for user 'test'@'localhost' (using password: YES)
我覺得我沒有跑LOAD DATA INFILE
我的代碼權限是:
<?php
$db = mysql_connect('localhost', 'test', 'test')
or die('Failed to connect');
mysql_select_db('test', $db);
$string = file_get_contents("http://www.xyz.com/email.txt", "r");
$myFile = "/home/xxx/public_html/email.txt";
$fh = fopen($myFile, 'w') or die("Could not open: " . mysql_error());
fwrite($fh, $string);
fclose($fh);
$result = mysql_query("LOAD DATA INFILE '$myFile'" .
" INTO TABLE email");
if (!$result) {
die("Could not load. " . mysql_error());
}
?>
任何其他好的方法可以accepted.please不直接在其他方面的建議存儲數據數據庫同時存儲電子郵件等。
而且您確定密碼正確嗎? – Palladium 2012-08-11 00:37:05
@鈀100%肯定,我已直接嘗試在phpmyadmin那裏我也得到相同的錯誤 – user1515503 2012-08-11 00:40:00