How to restrict user to choose 1 category for a post

I’ve solved this in the past for a client by using remove_meta_box to hide the default categories meta box, then adding my own meta box via add_meta_box which outputs categories as a drop-down select list, which effectively limits selection to a single item.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)