I did it like this:
Initialise geth in dev mode with the -- flag
geth --dev --allow-insecure-unlock
Never do this in mainnet mode.
Attach a web3 js console
Run this to create 10 unlocked accounts and fund them from the default account:
a = personal.newAccount('pwd')
Infura only supports a subset of the Ethereum JSON-RPC endpoints that web3 knows about. You can see the list in Infura's documentation.
The RPC that web3.personal.UnlockAccount is trying to use is called [personal_unlockAccount]. The personal module is all about maintaining a local wallet, including signing transactions and messages and creating new ...
Using HDWalletProvider you can also pass a single private key of the specific account that you want to use, instead of the mnemonic. Example:
//load single private key as string
let provider = new HDWalletProvider("3f841bf589fdf83a521e55d51afddc34fa65351161eead24f064855fc29c9580", "http://localhost:8545");