From MachineA login to MySQL shell and perform the below command as root user. If using hostname of second machine, then that should be added to /etc/hosts file of first machine.
MySQL
$ mysql -u root -p
mysql> GRANT ALL PRIVILEGES ON *.* TO '%'@'MachineB hostname or Ip address';
mysql> GRANT ALL PRIVILEGES ON *.* TO ''@'MachineB hostname or Ip address';