Store the result of query into a variable in MySQL

INSERT INTO users (first_name, last_name, password, user_name)
VALUES (N'ادمین',
        N'ادمین',
        N'c7ad44cbad762a5da0a452f9e854fdc1e0e7a52a38015f23f3eab1d80b931dd472634dfac71cd34ebc35d16ab7fb8a90c81f975113d6c7538dc69dd8de9077ec',
        N'admin');

INSERT INTO permissions (id, name) VALUES (1, N'ادمین');

SET @insertedId := (SELECT id
                    FROM users
                    WHERE user_name = N'admin');

INSERT INTO user_permissions (permission_id, user_id)
VALUES (1, @insertedId);