首先在终端登录mysql服务器[root@bogon ~]# mysql -uroot -proot
Welcome to the MySQL monitor. Com
mands end with ; or \g.
Your MySQL connection id is 681
Server version: 5.7.22-log Sourc
e distribution
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle&n
bsp;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
39; to clear the current input statement.
mysql>
从任何主机上使用root用户,密码:youpassword(你的root密码)连接到
mysql服务器:mysql > GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFI
ED BY 'youpassword' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00&
nbsp;sec)
刷新权限:mysql > FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
看看
是不是可以连上了呢~