1.登录mysql : mysql -u root -p
2.输入密码: Enter password: xxxxx
------ Server version: 8.0.15 MySQL Community Server - GPL
3.进入mysql数据库:use mysql;
4.设置允许远程用户访问:
MySQL [mysql]> GRANT ALL ON *.* TO 'root'@'%'
出现问题:ERROR 1410 (42000): You are not allowed to create a user with GRANT
原因:当前user表中没有root - %记录; 可以更新root - localhost 为 root - %
MySQL [mysql]> update user set host = '%' where user = 'root';
出现问题:ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'