mysql -u root -p <password> mysql->use mysql mysql->update user set host = '%' where user ='root'; mysql->grant all privileges on *.* to 'root'@'%' with grant option; mysql->flush privileges; mysql->exit;
找到MySQL的配置文件进行修改:
1
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
在mysqld.cnf中,找到这样一行配置:
1
bind-address = 127.0.0.1
修改为:
1
bind-address = 0.0.0.0
保存后重启MySQL:
1
sudo /etc/init.d/mysql restart
可以通过netstat -aptn检查MySQL的状态
1 2 3 4 5
(Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -
Traceback (most recent call last): File "/usr/lib/python3/dist-packages/ufw/util.py", line 427, in under_ssh ppid = get_ppid(pid) File "/usr/lib/python3/dist-packages/ufw/util.py", line 421, in get_ppid return int(ppid) ValueError: invalid literal for int() with base 10: 'S'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/sbin/ufw", line 138, in <module> not ui.continue_under_ssh(): File "/usr/lib/python3/dist-packages/ufw/frontend.py", line 901, in continue_under_ssh if self.backend.do_checks and ufw.util.under_ssh(): # pragma: no cover File "/usr/lib/python3/dist-packages/ufw/util.py", line 457, in under_ssh return under_ssh(ppid) File "/usr/lib/python3/dist-packages/ufw/util.py", line 457, in under_ssh return under_ssh(ppid) File "/usr/lib/python3/dist-packages/ufw/util.py", line 457, in under_ssh return under_ssh(ppid) [Previous line repeated 1 more time] File "/usr/lib/python3/dist-packages/ufw/util.py", line 434, in under_ssh raise ValueError(err_msg) ValueError: Couldn't find parent pid for '3129'