| Home| Progetto| Web| Faq| Acronimi | ||||
Argomenti Documenti pubblicabili:1120
Scripts:1282 Documenti non pubblicabili:162 Categorie tematiche:68 .Net |_C# |_Visual basic.net |_Asp.net Active Server Pages C++ Cascade Style Sheet JavaScript Mysql Php Xml Java |_Java 2 Micro Edition |_Java server pages |_Java Servlet Oracle |_PLSQL PostgreSQL Unix
Oracle...
Script:
Quick plsql script for dba maintenance tasks
Unix...
Tip:
Eseguire pił comandi in una sola linea
PLSQL...
Script:
TYPE TABLE
Mysql...
Tip:
How execute a sql script within mysql shell
Mysql...
Faq:
How do I change my database password?
Shell scripting...
Script:
Passing parameters to shell script
A User Agent, like a web browser, uses HTTP to request a HTML document
Php Funzione mail()
In programming the danger of exploring the small details of coding is that you get obsessed with every line of code you write, thereby greatly reducing productivity.
In general, is not worth obsessing over code. On the other hand you should code with deliberation and intent. Steven Feurstein Oracle Magazine July /August 2004 A User Agent, like a web browser, uses HTTP to request a HTML document
|
Mysql
Home >Mysql > mysql load file into a table
LOAD_FILE is a mysql function to load files on a table. For example, let's create a simple text file and make sure mysql has the rights. server1 ~ $ echo 'Hello I am a nice text file!' > /tmp/test.txt server1 ~ $ chown mysql:mysql /tmp/test.txt
server1 ~ $ mysql
Server version: 5.6.21-70.0-log Percona Server (GPL), Release 70.0, Revision 688
mysql> use demodb ;
Database changed
mysql> CREATE TABLE
-> `test` ( `id` bigint(20) NOT NULL, `data` longblob,
-> `file_type` varchar(20) DEFAULT NULL,
-> PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
Query OK, 0 rows affected (0.01 sec)
mysql> INSERT INTO test (id, data) VALUES(1, LOAD_FILE('/tmp/test.txt'));
Query OK, 1 row affected (0.00 sec)
mysql> select * from test;
+----+-------------------------------+-----------+
| id | data | file_type |
+----+-------------------------------+-----------+
| 1 | Hello I am a nice text file!
| NULL |
+----+-------------------------------+-----------+
1 row in set (0.00 sec)
For example if max_allowed_packet is set to 16M while trying to insert a 20M file you will get the "Warning 1301".
-- max_allowed_packet is set to 16M
mysql> show variables like 'max_allowed_packet' ;
+--------------------+----------+
| Variable_name | Value |
+--------------------+----------+
| max_allowed_packet | 16777216 |
+--------------------+----------+
1 row in set (0.00 sec)
-- max_allowed_packet is set to 16M
mysql> INSERT INTO test (id, data) VALUES(2, LOAD_FILE('/tmp/sample_file_20Msize.pdf'));
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+---------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+---------------------------------------------------------------------------------+
| Warning | 1301 | Result of load_file() was larger than max_allowed_packet (16777216) - truncated |
In this case you will need to increase accordingly the value on the configuration file (usually my.cnf) and reload mysql server . Warning: include(ads/text468x15.html): failed to open stream: No such file or directory in D:\inetpub\webs\fishscriptcom\documents\view_document.php on line 131 Warning: include(): Failed opening 'ads/text468x15.html' for inclusion (include_path='.;C:\php\pear') in D:\inetpub\webs\fishscriptcom\documents\view_document.php on line 131 Tutorial Creazione di un database e assegnazione di grant e password
Primi passi
[Mysql]
mysql dictionary tables
how list and find tables and other objects of databases schemas
[Mysql]
mysql inserting data with LOAD DATA INFILE
common errors and solutions
[Mysql]
Query per generare sql dinamici
tecniche dba
[Mysql]
Shell scripts executing mysql instruction
basic samples to execute sql and other commands via script and put results on file
[Mysql]
mysql load file into a table
Example with LOAD_FILE function to insert a file in longblob column
[Mysql]
Script Running existing sql files through prompt (like dos)
Executing sql script
[Mysql]
Utenti e grant
Assegnazioni di grant su tutto il database a nuovi utenti
[Mysql]
Comandi Data di oggi
Stampa data corrente
[Mysql]
Show databases visualizza i databases
Comandi iniziali
[Mysql]
Shutdown
Chiudere Mysql
[Mysql]
Uscire dalla shell di mysql
Comandi di base
[Mysql]
Funzione CONCAT
Concatenare i valori delle colonne di una query
[Mysql]
CURRENT_DATE()
Data odierna
[Mysql]
Drop index
Cancellare un indice
[Mysql]
Estrazione di occorrenze casuali da una query
Ordinamento attraverso la funzione RAND()
[Mysql]
Esempio formattazione data (giorno,mese,anno)
Formattare una data all'interno di un'istruzione SELECT con la funzione DATE_FORMAT
[Mysql]
Creazione di un database e di una semplice tabella
Primi passi con Mysql
[Mysql]
Inserire dei dati
Istruzioni di base
[Mysql]
Login prompt mysql
Accedere a mysql dalla shell
[Mysql]
Visualizzare gli indici associati ad una tabella
show index
[Mysql]
Creazione indice
Sintassi e finalitą
[Mysql]
QUERY: Clausola WHERE e LEFT JOIN
[Mysql]
|
CercaAnger is creative, depression is useless.
Dyson, Freeman J. Anger is creative, depression is useless.
Dyson, Freeman J.
Oracle...
Definizioni:
Area PGA
Shell scripting...
Script:
Compact if construct
fishScript.Com is accessible by Mobile access technology
as mobile phones, Palm and Pocket PC .
Nicoleta e Marco Magnani tutorial, examples, courses, esempi, corsi, esercizi, appunti vari Dottoressa Nicoleta Dragu Formatrice Docente Insegnante Mediatrice Culturale Dott. Marco Magnani Universita La Sapienza Roma Master Computer Science Hunter College New York , Data Base Administrator DBA oracle System architect | ||