Adding an admin user to WordPress from the Command Line

Insert a user into the 'wp_users' table and get that user's ID

INSERT INTO wp_users (user_login, user_pass, user_nicename, user_email, user_registered, user_status, display_name) VALUES ('nickh', MD5('someRandomPassword'), 'Nick', [email protected]', NOW(), 0, 'Nick Henry');
SET @lid := LAST_INSERT_ID();

Make the user that you just inserted an administrator

INSERT INTO wp_usermeta(user_id, meta_key, meta_value) VALUES (@lid, 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}');
INSERT INTO wp_usermeta(user_id, meta_key, meta_value) VALUES (@lid, 'wp_user_level', '10');