[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to import text file into database?

Posted on 2014-08-27
5
Medium Priority
?
280 Views
Last Modified: 2014-09-10
This is using mysql in a CentOS server. A database named AA is created. My development passed me a text file (.txt) and want me to import into this AA database, how should I do it? This is using for a wordpress web site, and numeral tables, such as, wp-commentmeta, wp-comment, wp-links, wp-options are there.

Please show step-by-step. Thanks first.
0
Comment
Question by:MichaelBalack
  • 2
  • 2
4 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 40288611
If you're new to PHP and MySQL, this article can help you get the foundation you need.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11769-And-by-the-way-I-am-new-to-PHP.html

In order to help with this, we would need to see the columns in the data base tables and the data in the text file.  As far as i know there is no "one-size-fits-all" method of importing text into a data base table, since there can be any number of data elements in either.

If you can post the CREATE TABLE statement for the tables in the AA database, along with a bit of the test data from your text file, we may be able to help you get started.  Or we may advise you to be respectful of your time and just hire an experienced programmer.
0
 
LVL 1

Author Comment

by:MichaelBalack
ID: 40289738
Hi Ray,

Thanks for your advice.

This AA is a new web site built on Wordpress. Maybe I go through the setup process down here. At first, apache web server is setup, follow by mysql & php, both with version 5.x. After that, I move this AA folder (created by my web vendor), to /var/www/html; Please see the folder list (of AA) as follows:

   AA
     -- cgi-bin (folder)
     -- wp-admin (folder)
    -- wp-contents (folder)
    -- wp-includes (folder)
    wp-admin.php, index.php

Open the wp-admin.php, and change the DB_User, DB_password, DB_host, etc correctly; Database name is AK. Use
MySQL command, type "mysql -u root -e create database AA"; to create AA DB.

In MySQL, after "use AA", and then type "show tables" with list of tables in display as follows:

wp-commentmeta
wp-comments
wp-links
wp-options
wp-postmeta
wp-posts
wp-terms
wp-taxonomy
wp-term_relationships
wp-usermeta
wp-users

I also setup the adminer in Wordpress. When I tried to import the txt file (2.3 Mb), the following oversize error occurs:

Please see the attached adminer_error1

thanks,
adminer-error1.bmp
0
 
LVL 1

Author Closing Comment

by:MichaelBalack
ID: 40313581
As Ray suggested, I don't even know how to conduct the commands as stated, I have outsource the whole tasks to a web-hosted provider.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 40314631
I think outsourcing this is a very good idea!  Thanks for the points, ~Ray
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses
Course of the Month17 days, 16 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question