vagrant@ubuntu-bionic:~$ mysql -uroot -p Enter password: mysql> use mysql; mysql> CREATE USER 'remoteuser'@'%' IDENTIFIED BY 'zhijieliaodang666'; # 将所有权限赋予 用户 remoteuser mysql> GRANT ALL ON *.* TO 'remoteuser'@'%'; # 如果你想只允许特定的Ip连接MySQLServer,那么可以这么写 # mysql> ALTER USER 'remoteuser'@'{指定ip}' IDENTIFIED WITH mysql_native_password BY 'zhijieliaodang666'; mysql> ALTER USER 'remoteuser'@'%' IDENTIFIED WITH mysql_native_password BY 'zhijieliaodang666'; # 刷新权限 mysql> FLUSH PRIVILEGES; mysql>exit # 推出并重启MySQL vagrant@ubuntu-bionic:~$ sudo service mysql restart