Results 1 to 7 of 7

Thread: Mysql question

  1. #1

    Default Mysql question

    I've installed mysql 5.0.51a-Max and I am trying to learn it through MySQL :: MySQL 5.0 Reference Manual :: 3 Tutorial

    There's a part where I apparently needed to configure the installation so that mysql> LOAD DATA LOCAL INFILE can be used.

    What this does, is enable me to have 'tab separated text' from a .txt file imported to a table.

    Well, I installed it through yast and I didn't get the opportunity to include in the compilation the LOAD DATA LOCAL INFILE something or other.

    So now, how do I import a .txt file into a mysql table?

  2. #2

    Default Re: Mysql question

    So now, can someone walk me through reconfiguring LOAD DATA LOCAL INFILE so I can import a .txt file into a mysql table?" The links on the tutorial got me all messed up.

    Thank You

  3. #3
    Join Date
    Jun 2008

    Default Re: Mysql question

    I may not completly understand your question, but I do import a table from a text file (I suppose you mean by a .txt file a file wich contains a 'flat' ASCII file).
    I have the following ksh script (bash will accept this also becuase it containt no specificly ksh things imho):

    mysql -p <<EOF
    DROP DATABASE spoorwegen;
    CREATE DATABASE spoorwegen;

    USE spoorwegen

    CREATE TABLE boek (
    auteur VARCHAR(100) NOT NULL,
    titel VARCHAR(100) NOT NULL,
    otitel VARCHAR(100) NOT NULL,
    uitg VARCHAR(60) NOT NULL,
    plaats VARCHAR(30) NOT NULL,
    jaar VARCHAR(4) NOT NULL,
    isbn VARCHAR(13) NOT NULL,
    onderw VARCHAR(100) NOT NULL,
    land VARCHAR(100) NOT NULL,
    PRIMARY KEY (id)
    DATA DIRECTORY = '/home/databases/spoorwegen'
    INDEX DIRECTORY = '/home/databases/spoorwegen';

    LOAD DATA INFILE '/home/databases/spoorwegen/spoorwegen.inport' INTO TABLE boek;

    And the file /home/databases/spoorwegen/spoorwegen.inport has the contents:
                    Op de Rails 29e jaargang 1961   Maandblad van de NVBS   NVBS            1961
                    Op de Rails 30e jaargang 1962   Maandblad van de NVBS   NVBS            1962
                    Op de Rails 31e jaargang 1963   Maandblad van de NVBS   NVBS            1963
    which fields seperated by tabs.

    Calling the script asks you to enter the password of the MySQL root user (not the system root). The DROP DATABASE must be removed when the database does not exist else the script stops there with an error.

    I did not look into the meaning of the second LOCAL in your statement, but this is how mine works.

    Hope this helps.
    Henk van Velden

  4. #4

    Default Re: Mysql question

    Thank You for your help'''

    It seems that leaving the the command "LOCAL" out, it works. This is something that should be posted in the tutorial at the end of chap 3.3.3.

  5. #5
    Join Date
    Jun 2008
    Blog Entries

    Default Re: Mysql question

    Section 12.2.5 explains when LOCAL means.

  6. #6

    Default Re: Mysql question

    Yep...thar it is...


  7. #7

    Default Re: Mysql question

    Yep...there it is... I was only on the beginning stretch when i got thrown off my horse. (chap 3)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts