MySQL: Data truncated for column 'Password' at row
A client had an error which I had not seen. Seems that MySQL had some issues and was truncating the password hash which basically killed the users account. The solution, in this case, was to upgrade from MySQL 4.1.15 to 4.1.18 (the bug was resolved in 4.1.16), run mysql with --skip-grant-tables and finally run /usr/bin/mysql_fix_privilege_tables.Here's what you may see if you encounter this error:
mysql> use `mysql`;This was peculiar as another user at the bug listed above had varchar(16) for the Type on the Password field. After running mysql_fix_privilege_tables, it displayed varchar(41).
mysql> show columns from `user` like 'Password';
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| Password | char(16) | | | | |
+----------+-------------+------+-----+---------+-------+
1 row in set (0.00 sec)
mysql> update user set password=password('bar') where user='foo';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> show warnings;
+---------+------+-----------------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------------+
| Warning | 1265 | Data truncated for column 'Password' at row 5 |
+---------+------+-----------------------------------------------+
mysql> select user, password from user where user='foo';
+------+------------------+
| user | password |
+------+------------------+
| foo | *E8D46CE25265E54 |
+------+------------------+
A little more clarification as to what was done to fix this.
- Stop MySQL
- Upgrade MySQL to 4.1.18, 5.0.16 or better
- Run mysqld_safe &
- Run /usr/bin/mysql_fix_privilege_tables
- Jump into mysql, simply running mysql should work.
- Reset your users password with:
- mysql> use mysql;
- mysql> update user set password=password('bar') where user='foo';
- If this completes properly, you should receive zero (0) warnings. If you do see a warning, type SHOW WARNINGS; and Google it ;)
- Exit mysql and restart it either with service mysqld restart or /etc/init.d/mysql restart



