Find my.cnf in the directory /etc/mysql, edit with vim, and find the inside of my.cnf
# bind-address =127.0.0.1
Comment the code that can only be accessed by local ip
Then use root to log in to the Mysql database
im@58user:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \g.
Your MySQL connection id is 6
Server version:5.5.53-0ubuntu0.14.04.1(Ubuntu)Copyright(c)2000,2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h'for help. Type '\c' to clear the current input statement.
mysql>
And then execute
mysql> grant all on *.* to root@'%' identified by '123';
myslq> flush privileges;
Finally, you can log in to mysql remotely with the user and password you just created.
The following error may be encountered when executing the user authorization password:
ERROR 1290(HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
Solution:
First refresh the permission table.
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> grant all on cactidb.* to dbuser@'localhost' identified by '123';
Query OK, 0 rows affected (0.00 sec)
Recommended Posts