0

I want to update table data in CSV format with LOAD DATA INFILE command on my shared hosting server, but failed and the error message "access denied for user .... (using password yes)". The error seems to relate to permissions / grant. but I can not get into the root. how to solve the problem or is there another way to update a table with a large data? This is my php script:

$result = mysql_query("LOAD DATA INFILE 'rekap.csv' 
INTO TABLE remaik 
FIELDS TERMINATED BY ',' 
OPTIONALLY ENCLOSED BY '\"' 
LINES TERMINATED BY '\r\n' 
(kode, nama, awal, debet, kredit, tawal, tdebet, tkredit)");
if(!$result) {
    die("Rekap Piutang Tidak Dapat Diupdate - " . MySQL_Error());
}

thanks for the help

Ori Lentz
  • 3,668
  • 6
  • 22
  • 28
agus priyo
  • 95
  • 1
  • 9
  • It seems your mysql server has username and password set. Ask your admin to get it or you can get it in config file of your project. – PHPExpert Feb 18 '16 at 05:16
  • because it is a shared hosting, the admin was not willing to tell username and password. is there another way to update the table with large cvs data if not using LOAD DATA INFILE command – agus priyo Feb 18 '16 at 05:27
  • Yes, assign specific name to your csv files. Place in one proper folder. Then write a Cron script in php that will read CSV files and will update database. – PHPExpert Feb 18 '16 at 05:28
  • I am not familiar with cron script, I will try to learn first, thank you – agus priyo Feb 18 '16 at 05:41
  • Sure, Welcome:) [This link](http://stackoverflow.com/questions/18737407/how-to-create-cron-job-using-php) will help you to get more details of cron. – PHPExpert Feb 18 '16 at 05:42

0 Answers0