- mysql -u <user> -p --local-infile
(the --local-infile is necessary, otherwise you will get error during dataloading: ERROR 1148 (42000): The used command is not allowed with this MySQL version) - use <database>
- create table script (create_tables.sql) in text editor
drop table kontakt;
create table kontakt
(klkood bigint(20)
,kontakti_liik varchar(32)
,vaartus varchar(100)
,kasutusluba varchar(100)
,keeluaeg varchar(100)
);
create index kontakt_klkood on kontakt(klkood); - run the script from mysql prompt
.\ create_tables.sql - create load data script (load_data.sql) in text editor
LOAD DATA LOCAL INFILE '/vagrant/uptime/EA_kliendi_kontaktinfo_3012.csv' INTO TABLE kontakt
FIELDS TERMINATED BY ';'
LINES STARTING BY '"' TERMINATED BY '"\r\n'
IGNORE 1 LINES; - run the script from mysql prompt
.\ load_data.sql - If there are warnings then execute
show warnings
Tuesday, December 31, 2013
How to load CSV file to Mysql database
There some tricks to know how to load csv file to mysql:
Thursday, December 5, 2013
How to install mysql and mysql workbench in Ubuntu 12.04
Its really simple task to install mysql server and mysql workbench in Ubuntu 12.04. You shuold run from commandline
sudo apt-get install mysql-server
sudo apt-get install mysql-workbench
First row installs mysql server, asks root password and starts mysql service. To restart server run
sudo service mysql restart
Second row installs mysql-workbench and you are ready to access mysql server in localhost.
sudo apt-get install mysql-server
sudo apt-get install mysql-workbench
First row installs mysql server, asks root password and starts mysql service. To restart server run
sudo service mysql restart
Second row installs mysql-workbench and you are ready to access mysql server in localhost.
Subscribe to:
Posts (Atom)