Import data from MySql to Stata - mysql

I have a MySql table with more than 100,000 records and would like to analyse the data in Stata. Is there any way to import the MySql table in Stata?

You can use ODBC or a plugin to directly connect Stata to MySQL; or you can export the data from MySQL (e.g. to a CSV file, via SELECT ... INTO OUTFILE or mysqldump) and then import into Stata.

Related

Sqoop - Manipulate a Mysql table before importing to HDFS

Can we edit the table by selecting specific columns or other conditions in MYSQL to save as a new table in the MYSQL database before import to HDFS?
Yes, we could save a new table to MySQL before exporting it to HDFS. Also we could edit the file with vi editor and export it to HDFS. But it would be much easier to use sqoop.
You can use sqoop evel before sqoop import for some purpose.

mySQL importing a database into my database

I'm currently on a database and I'm trying to import another database into it.
The database is called metmessage_db_dump.sql.txt
I am using a SQL client.
How can I import this database?
Simply, rename you file to : metmessage_db_dump.sql and import via PhpMyAdmin.

MySQL Workbench Import CSV File Restrition

I'm trying to import a csv file into MySQL 5.7 using the MySQL Workbench import module.
It's everything ok, the data are correctly readed by the module.
But I have 11.000 rows.
The module are just importing 29.
Is there any configuration restricting my full import?
I had the same problems as yours. I got around it by the following steps:
after the MySQL Workbench import clear all the table rows by truncate(but reserve the table itself)
Using MySQL command line
LOAD DATA LOCAL INFILE '/data.csv' INTO TABLE my_table FIELDS TERMINATED BY ','
Hope it helps.

Import CSV file into MySQL without using load data infile

I have recently switched web hosting providers and the new provider does not allow 'load data infile' commands in MySQL. However, I have many CSV files that update tables in a database weekly using that command. What is the best way to import into MySQL without the typical load data option? I tried mysqlimport, but that seems to fail since the data isn't in SQL format, its just standard CSV data. Thanks for your help.
Use the following process:
Convert the CSV to the MySQL CSV dump format
Upload the file to the MySQL server or to the shared hosting file system
Use one of the following commands to import it:
mysqladmin:
mysqladmin create db1
mysql db1 < dump.csv
mysql:
mysql> CREATE DATABASE IF NOT EXISTS db1;
mysql> USE db1;
mysql> source dump.csv
References
MySQL :: MySQL 5.7 Reference Manual :: 7.4.2 Reloading SQL-Format Backups
Text::CSV::Auto - Comprehensive and automatic loading, processing, and analysis of CSV files. - metacpan.org
MySQL :: MySQL 5.7 Reference Manual :: 8.4.3 Dumping Data in Delimited-Text Format with mysqldump
Restore data from a tab delimited file to MySQL - Electric Toolbox
Using mysqldump to save data to CSV files - Electric Toolbox
Mysqldump in CSV format

MySQL online import and export

I need to Export and Import MySQL database online, in order to transfer data from/ to a network. Currently I use this functionality with 'mysqldump' . But it has a limitation that if I import a database to existing database, the database get updated with new values from imported Database.
My current requirement is to export a database in source and import it to destination , provided the IP address or system name. And I am supposed to perform the import and export via INFILE and OUTFILE.
Edit :
In my application there are 3 options,
Export database - Export the database from application to the local system
Import database - Import the database from a file in local system to the database in application
Online interchange - Export database from the source and Import to the destination system.
The import and Export from and to local is implemented via INFILE and OUTFILE scenario. I wish to perform the Online interchange also with the same concept rather than mysdqldump.
Thanks in advance.
I think a better solution is to use replication. It would be safer.