By default, you’re not allowed to connect to your MySQL database from other machine.
To enabled that, you first need to set a password to root user in your MySQL Database:
mysqladmin -u root password 'password'
To login to MySQL, use
mysql -u root -p
Once you login to your MySQL, use the following command in MySQL:
GRANT ALL on *.* to 'username'@'localhost' identified by 'password'; FLUSH PRIVILEGES;