'mysql insert current_user() by default

I have a table like

create table try ( firstname varchar(4), username varchar(4))

My question is that is there a way to insert the current_user() or user() value in the username field by default.

So for example if I am logged in to the database as 'abcduser' then

insert into try values( 'kashif');

select * from try

kashif abcduser

Is this possible , just how I can insert defualt timestamp by doing something like ARRIVAL_TIME timestamp not null DEFAULT CURRENT_TIMESTAMP

is this is not possible, then what are the alternatives?



Solution 1:[1]

I suggest using a table insert trigger with the USER() function.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Soberdan