mysql -u root
mysql> SET PASSWORD FOR ‘ROOT’@’LOCALHOST”
> = PASSWORD(‘new_password’);
Create a new HOST for root and allow root to login from anywhere.
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’
> IDENTIFIED BY ‘password’ WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
Allow remote logins.
sudo vi /etc/mysql/my.cnf
Out-of-the-box, MySQL only allows connections from the localhost identified by the IP Address of 127.0.0.1. We need to remove that restriction, so find the line that says
bind-address = 127.0.0.1
and comment it out.