# in Ubuntu 16.04, the path should be /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address = 127.0.0.1 as below:
# localhost which is more compatible and is not less secure.
# bind-address = 127.0.0.1 # or you can change its value to 0.0.0.0
Restart MySQL service with
# service mysql restart
to make changes into effect.
Login MySQL as root, then run the code as below[change the field you want]:
CREATE USER 'USER_NAME'@'localhost' IDENTIFIED BY 'NEW-PASSWORD';
GRANT ALL PRIVILEGES ON DB_NAME.* TO 'USER_NAME'@'localhost' WITH GRANT OPTION;
CREATE USER 'USER_NAME'@'%' IDENTIFIED BY 'NEW-PASSWORD';
GRANT ALL PRIVILEGES ON DB_NAME.* TO 'USER_NAME'@'%' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';