newit1
Goto Top

Kein Zugriff auf PHPmyAdmin

Hallo,

mit folgendem Skript will ich eine CSV-Datei in eine Tabelle meiner Datenbank importieren.

#Import der CSV in die Datenbank.

mysql --user=administrator --password=test \
-e "USE Datenbank1;" \  
-e "CREATE TABLE IF NOT EXISTS tabelle1_backup LIKE tabelle1;" \  
-e "TRUNCATE TABLE tabelle1_backup;" \  

--------------

-e "LOAD DATA INFILE \"/home/administrator/testordner/test.csv \" INTO TABLE   
tabelle1_backup CHARACTER SET 'utf8' FIELDS TERMINATED BY ';' ;" \  


Das kurisose dabei ist, das er alle Befehle bis zum gekennzeichneten Trennstich einwandfrei ausführt
Wenn ich allerdings den "LOAD DATA INFILE" - Befehl dazu nehme um die CSV-Datei zu importieren schreibt er:

"Access denied for user 'administrator'@'localhost' (using password:YES)


Weiß einer woran das liegen kann?

Viele Grüße

Content-Key: 386076

Url: https://administrator.de/contentid/386076

Printed on: April 25, 2024 at 00:04 o'clock

Member: Arano
Arano Sep 11, 2018 updated at 09:13:42 (UTC)
Goto Top
Moin moin

Mensch newit... HANDBUCH !

https://dev.mysql.com/doc/refman/8.0/en/load-data.html
---
Non-LOCAL load operations read text files located on the server. For security reasons, such operations require that you have the FILE privilege. See Section 6.2.1, “Privileges Provided by MySQL”.

Hat dein User diese Berechtigung ?


~Arano
Member: newit1
newit1 Sep 11, 2018 updated at 09:21:53 (UTC)
Goto Top
Alles schon gecheckt... hat er


EDIT:

Sorry... nützt alles nix wenn der Kollege das Passwort ändert
Member: juhu01
juhu01 Sep 17, 2018 at 09:31:17 (UTC)
Goto Top
Dein Problem liegt beim quoten des Befehls.

-e "LOAD DATA INFILE \"/home/administrator/testordner/test.csv \" INTO TABLE tabelle1_backup CHARACTER SET 'utf8'FIELDS TERMINATED BY ';' ;" \

ich würde es einmal so probieren .....CHARACTER SET \'utf8\' und am Ende TERMINATED BY \';\' ;
Das sollte deine Syntax-Fehler beheben.
Grund die Shell die das Zeichen ' schon auflöst und der Mysql-Interpretor falsche Informationen bekommt.

servus