Patrik,
Friday, May 31, 2002, 2:22:10 AM, you wrote:
PB> I suspect that there might be a bug in the LOAD DATA and SOURCE statements
PB> of MySQL-4.0.1-2 (alpha), but since I'm not 100% sure, I am sending this
PB> to the list and maybe someone else migt be able to reproduce...
PB> My configuration:
PB> RedHat Linux 7.3 on i686
PB> MySQL-4.0.1-2 server+client
PB> MySQL built with rpm's from MySQL site.
PB> The problem:
PB> When issuing (from within the mysql client) the following statement;
PB> mysql> LOAD DATA LOCAL INFILE '/path/to/data' INTO TABLE table;
PB> ERROR 2013: Lost connection to MySQL server during query
PB> It reads the first line from my file, and then drops connection.
PB> Also when trying to run "SQL script" with the SOURCE command I get this
PB> error. I found that I cannot create some INNODB tables from within my
PB> script (some INNODB tables are created and some are not, I can't figure
PB> out why).
PB> My SOURCE file looks like this (shortened a bit):
PB> DROP DATABASE db;
PB> CREATE DATABASE db;
PB> USE db;
PB> CREATE TABLE customers (
PB> customers_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
PB> INDEX customers_index (customers_id),
What for do you index customers_id one more time? (customers_id is a
PRIMARY KEY, so it is indexed)
PB> companyname VARCHAR(80) NOT NULL,
PB> contactname VARCHAR(80) NOT NULL,
PB> contactemail VARCHAR(80) NOT NULL,
PB> address VARCHAR(80) NOT NULL,
PB> postalcode VARCHAR(10) NOT NULL,
PB> city VARCHAR(80) NOT NULL,
PB> state VARCHAR(5),
PB> country VARCHAR(80) NOT NULL,
PB> PRIMARY KEY(customers_id)
PB> )
PB> TYPE=INNODB;
PB> LOAD DATA LOCAL INFILE '/path/to/customers_data' INTO TABLE customers;
PB> CREATE TABLE users (
PB> users_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
PB> username CHAR(10) BINARY NOT NULL,
PB> password CHAR(255) BINARY NOT NULL,
PB> customers_id INT NOT NULL,
PB> FOREIGN KEY (customers_id) REFERENCES customers(customers_id),
PB> PRIMARY KEY(users_id)
PB> )
PB> TYPE=MYISAM;
PB> /* Used to be INNODB, but that don't work */
You must create index on customers_id! Foreign key and referenced key
must be indexed and thay must have similar internal data types inside
InnoDB! So, you should also specify customers_id as INT UNSIGNED NOT
NULL.
Check manual:
http://www.mysql.com/doc/S/E/SEC446.html
PB> LOAD DATA LOCAL INFILE '/path/to/users_data' INTO TABLE users;
PB> However, I "downgraded" to server version 4.0.0-alpha (I had the rpm's
PB> lying around since earlier, so I gave it a shot), both LOAD DATA and SOURCE
PB> statements work fine (with the same files that I tried to use with
PB> 4.0.1-2).
Correct you script and check if error occurs again.
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Victoria Reznichenko
/ /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED]
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net
<___/ www.mysql.com
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php