I expect that others (like me) will find this question in search of a pure-SQL method of creating these API users. Below you can find a solution for creating a new API user with "All" permissions. Just modify the first few variables to set your desired user/pass, then run these queries against the database.
SET @api_password='super_secret'; -- Set your desired API password here
SET @api_username='export_connector'; -- Set your desired API username here
SET @api_email='example@example.com'; -- Change this if you want.
SELECT @api_password_hash:=md5(@api_password);
INSERT INTO `api_role` (`role_id`, `parent_id`, `tree_level`, `sort_order`, `role_type`, `user_id`, `role_name`)
VALUES
(NULL, 0, 1, 0, 'G', 0, 'Export Connector');
SELECT @new_role_id:=LAST_INSERT_ID();
INSERT INTO `api_rule` (`rule_id`, `role_id`, `resource_id`, `api_privileges`, `assert_id`, `role_type`, `api_permission`)
VALUES
(NULL, @new_role_id, 'all', NULL, 0, 'G', 'allow');
INSERT INTO `api_user` (`user_id`, `firstname`, `lastname`, `email`, `username`, `api_key`, `created`, `modified`, `lognum`, `reload_acl_flag`, `is_active`)
VALUES
(NULL, 'Export', 'Connector', @api_email, @api_username, @api_password_hash, NOW(), NOW(), 0, 0, 1);
SELECT @new_user_id:=LAST_INSERT_ID();
INSERT INTO `api_role` (`role_id`, `parent_id`, `tree_level`, `sort_order`, `role_type`, `user_id`, `role_name`)
VALUES
(NULL, @new_role_id, 1, 0, 'U', @new_user_id, 'Export');
If you use table prefixes, you'll need to change the table names.
You can probably change the firstname/lastname/role name too, but I didn't try.
Reason for doing this with pure-SQL is that we manage hundreds of Magento stores, each with differing codebases. We needed to get API access into them to pull data out, without making [testing] code changes in each store, and manually creating these would be extremely tedious.