By default MySQL only listens to localhost, if we want to enable the remote access to it, then we need to made some changes in my.cnf file:
We need to comment out the bind-address and skip-external-locking lines.
Restart mysql
Check the process:
lsof -i -P | grep :3306
Create user:
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass';
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';
Grant access:
GRANT ALL ON *.* TO 'myuser'@'localhost';
GRANT ALL ON *.* TO 'myuser'@'%';
FLUSH PRIVILEGES;