Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 10/10/2013, à 23:33

bmzoom

[En attente] Load DATA LOCAL INFILE

bonjour ,

LOAD DATA LOCAL INFILE n'est pas conseillé et activé sur serveur mysql

Question : Comment importer des data de fichiers 'csv' réguliers avec un minimum de clic ?

#1148 - The used command is not allowed with this MySQL version

cool

Dernière modification par bmzoom (Le 12/10/2013, à 11:34)

Hors ligne

#2 Le 11/10/2013, à 07:48

J5012

Re : [En attente] Load DATA LOCAL INFILE

creer utiliser un script (php par ex) pour traiter le csv et le convertir avant de l'enregistrer dans la base ...
http://php.net/manual/fr/function.fgetcsv.php
http://www.commentcamarche.net/forum/af … v-vers-bdd

Hors ligne

#3 Le 11/10/2013, à 10:08

bruno

Re : [En attente] Load DATA LOCAL INFILE

Tu utilises quoi pour importer tes fichiers csv ? mysqldbimport ?

Hors ligne

#4 Le 11/10/2013, à 10:53

bmzoom

Re : [En attente] Load DATA LOCAL INFILE

mysqldbimport ?

Non , pour l'instant j'utilise la console de phpmyadmin

LOAD DATA LOCAL INFILE  c'est verrouillé sur le mysql d'un nas qui communique en externe .
Il y a risque d'intrusion , mais pour un pc en serveur interne , cela peut se dévérouiller .
Après , c'est une requête sql qui va cherche le csv en un clic , et ranger les data dans la table

Faut toucher aux fichiers de config de mysql et dèjà savoir où ils se trouvent ( pour ne pas tout casser ) 

LOAD DATA LOCAL INFILE '/media/chemin ...../10.csv' INTO TABLE `10_tt` FIELDS TERMINATED BY ';' 
ESCAPED BY '\\' LINES TERMINATED BY '\n'

Dernière modification par bmzoom (Le 11/10/2013, à 11:03)

Hors ligne

#5 Le 11/10/2013, à 13:58

alej

Re : [En attente] Load DATA LOCAL INFILE

loose-local-infile=1

... dans la section [client] de "/etc/mysql/my.cnf" ou de "~/.my.cnf"

Hors ligne

#6 Le 11/10/2013, à 15:05

bmzoom

Re : [En attente] Load DATA LOCAL INFILE

Cela ne suffit pas :

#1148 - The used command is not allowed with this MySQL version

Logiciel: MySQL
Version du logiciel: 5.5.32
Version du protocole: 10

Phpmyadmin Version: 3.5.8.1deb1

Hors ligne

#7 Le 11/10/2013, à 15:18

bruno

Re : [En attente] Load DATA LOCAL INFILE

C'est

local-infile=1

qu'il faut mettre dans my.cnf  sections [mysql] et [mysqld] (et relancer le service mysql)

Dernière modification par bruno (Le 11/10/2013, à 16:59)

Hors ligne

#8 Le 11/10/2013, à 15:25

alej

Re : [En attente] Load DATA LOCAL INFILE

bmzoom a écrit :

Cela ne suffit pas

Bizarre...

Hors ligne

#9 Le 11/10/2013, à 16:56

bmzoom

Re : [En attente] Load DATA LOCAL INFILE

L'un ou l'autre ne donne rien , j'ai ce script complet :

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port		= 3306
socket		= /var/run/mysqld/mysqld.sock
local-infile=1

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket		= /var/run/mysqld/mysqld.sock
nice		= 0

[mysqld]
#
# * Basic Settings
#
user		= mysql
pid-file	= /var/run/mysqld/mysqld.pid
socket		= /var/run/mysqld/mysqld.sock
port		= 3306
basedir		= /usr
datadir		= /var/lib/mysql
tmpdir		= /tmp
lc-messages-dir	= /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address		= 127.0.0.1
#
# * Fine Tuning
#
key_buffer		= 16M
max_allowed_packet	= 16M
thread_stack		= 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit	= 1M
query_cache_size        = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries	= /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id		= 1
#log_bin			= /var/log/mysql/mysql-bin.log
expire_logs_days	= 10
max_binlog_size         = 100M
#binlog_do_db		= include_database_name
#binlog_ignore_db	= include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]
quick
quote-names
max_allowed_packet	= 16M

[mysql]
#no-auto-rehash	# faster start of mysql but no tab completition

[isamchk]
key_buffer		= 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/

#1148 - The used command is not allowed with this MySQL version

Hors ligne

#10 Le 11/10/2013, à 17:00

bruno

Re : [En attente] Load DATA LOCAL INFILE

Essaie de mettre :

local-infile=1

dans les sections [mysql] et [mysqld]

Hors ligne

#11 Le 11/10/2013, à 17:10

bmzoom

Re : [En attente] Load DATA LOCAL INFILE

C'est de l'essai et je ne veux pas perdre mes data , avec un plantage .
J'arrête les bidouillages .. ( il faut du codage qui fonctionne déjà ! )

hmm

Hors ligne

#12 Le 12/10/2013, à 00:14

J5012

Re : [En attente] Load DATA LOCAL INFILE

tu peux aussi convertir toi-meme le csv d'abord, tu peux d'ailleurs normalement le faire avec phpmyadmin ...

Hors ligne

#13 Le 12/10/2013, à 09:20

bmzoom

Re : [En attente] Load DATA LOCAL INFILE

Tout est faisable quand le résultat est au bout :

http://forum.ubuntu-fr.org/viewtopic.php?id=1392111

mysql_query("INSERT INTO membres VALUES('','nouveau','nvpass','nouveau@fai.fr')");

Un enregistrement à la fois , c'est facile , et le moulin à légumes peut faire mieux ..

Dernière modification par bmzoom (Le 12/10/2013, à 11:04)

Hors ligne

#14 Le 12/10/2013, à 22:04

J5012

Re : [En attente] Load DATA LOCAL INFILE

je pensais a un import de table ; le format csv est un type de stockage texte (dit flat) de donnees comme une base, il suffit de retirer le symbole de separation comme le point virgule (;)
voir la demo de http://www.phpmyadmin.net/home_page/index.php

Hors ligne

#15 Le 12/10/2013, à 22:16

bmzoom

Re : [En attente] Load DATA LOCAL INFILE

Load DATA LOCAL INFILE

Trop généraliste , une démo , sans cas concrêt ..

Hors ligne

#16 Le 12/10/2013, à 23:08

J5012

Re : [En attente] Load DATA LOCAL INFILE

tu t'obstines a ne pas bien regarder ...

Hors ligne

#17 Le 12/10/2013, à 23:36

bmzoom

Re : [En attente] Load DATA LOCAL INFILE

.. Essayer phpMyAdmin 4.08 ?

Une fonction du php , peut mettre plusieurs csv en insertion dans une bdd .

Cette méthode est modulable et rater , c'est un tremplin pour
faire beaucoup mieux !

Dernière modification par bmzoom (Le 12/10/2013, à 23:48)

Hors ligne