HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

MySQL unknown column 'password_last_changed'

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
unknownmysqlpassword_last_changedcolumn

Problem

When creating a user using this command

create user 'foo'@localhost';


this error is shown

ERROR 1054 (42S22): Unknown column 'password_last_changed' in 'mysql.user'


Using MySQL server version: 5.7.6 on linux

I tried to add it but I dont know its data-type
How can I fix this

Solution

From the 5.7.6 release notes:


If you upgrade to this release of MySQL from an earlier version, you
must run mysql_upgrade (and restart the server) to incorporate the
changes to the mysql database. mysql_upgrade moves Password column
values to the authentication_string column and removes the Password
column. For nonupgraded installations that have no account_locked
column, the server treats all accounts as unlocked, and attempts to
lock or unlock and account produce an error.

Although you will find similar issues in every upgrade, so running this tool is a must. password_last_change was added in 5.7.4, so you must update the table definitions.

Please note that at the time, upgrades from 5.6 are supported, but not from 5.5 at the moment of writing these lines, so if you have upgraded directly from 5.5 or below you will likely find problems.

Context

StackExchange Database Administrators Q#97058, answer score: 6

Revisions (0)

No revisions yet.