Disable user from MySQL Database

Gary Goodger6 years ago

Hello,

I am trying to find a way to disable a user directly from the database, we are using MySQL. However, I cannot seem to find the correct table. One would assume it's the "Disabled" field in the "Users" table, however when I manually disable a user this field does not update.

I have tried manually adding an entry to the field however MySQL rejects it with "ERROR 1406 (22001): Data too long for column 'disabled' at row 1"

Could someone point me to the right direction where the Disabled user attribute is set in the database?

Thank you

Anton Tananaev6 years ago

Correct column, but what value are you trying to set it to?

Gary Goodger6 years ago

I was just trying with a 1.

When setting the user to disabled in the UI, it does not populate the database disabled field with any value, which is what has confused me. The user is being disabled, so not sure why the DB isn't being populated.

Anton Tananaev6 years ago

It is populated.

Gary Goodger6 years ago

But it's not? The table entry for disabled under the user ID is blank. The only populated field appears to be admin. What value should be expected?

Anton Tananaev6 years ago

If you don't see something it doesn't means it's not there. I'll just leave this here:

https://dev.mysql.com/doc/refman/5.7/en/bit-type.html

I would recommend to study MySQL documentation more.

Gary Goodger6 years ago

Ergh yes sorry, you're right! All good then.

Thanks

Howard6 years ago

Hi Anton
A similar problem that i have. I try to enable the users directed with SQL commands, from table "users" to set the disabled value to 0

UPDATE users
SET disabled = 0
WHERE email = xxx@xx;

and it update the value from 1 to 0

I expect that I can login, but it is not.

So i go to UI with admin Users still "disabled" , that means database field should be 1

Please see my photos as linked

https://www.dropbox.com/s/kskoxym9tcjo0o3/Disabled_1.jpg?dl=0
https://www.dropbox.com/s/4r4hkdok5a6v44d/Disabled_2.jpg?dl=0

Anything that I missed to make the UI and DB synced?

Anton Tananaev6 years ago

There is cache. You have to use API instead of directly changing data in the database.

Howard6 years ago

thanks, let me try it!!