Forum Moderators: open

Message Too Old, No Replies

Data too long for column

         

sfast

11:25 pm on Mar 30, 2007 (gmt 0)

10+ Year Member



CREATE TABLE tbl_auth_user (
id int NOT NULL auto_increment,
user_id varchar(20) NOT NULL default '',
user_password char(32) binary NOT NULL default '',
PRIMARY KEY (id),
UNIQUE KEY username (user_id)
);

I have this table. But when I try to insert a row, it shows me error -

INSERT INTO tbl_auth_user (user_id, user_password) VALUES ('admin', PASSWORD('admin'));

ERROR 1406 (22001): Data too long for column 'user_password' at row 1

What causes this error?
What should be done to accept the password?

eelixduppy

11:30 pm on Mar 30, 2007 (gmt 0)



The column is too small to contain the password data. You must increase it to 41 bytes:

user_password char[b](41)[/b]

[dev.mysql.com...]

sfast

11:58 pm on Mar 30, 2007 (gmt 0)

10+ Year Member



Thanks. It is working now.