mysql8.0修改密码:

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的password';

msyql开启实现远程连接

   将host字段的值改为%就表示在任何客户端机器上能以root用户登录到mysql服务器,建议在开发时设为%。   
   update user set host = ’%’ where user = ’root’;

   将权限改为ALL PRIVILEGES

mysql> use mysql;
Database changed
mysql> grant all privileges  on *.* to root@'%' identified by "password";
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> select host,user,password from user;
+--------------+------+-------------------------------------------+
| host           | user | password                                  |
+--------------+------+-------------------------------------------+
| localhost    | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E |
| %               | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E |
+--------------+------+-------------------------------------------+
3 rows in set (0.00 sec)

这样机器就可以以用户名root密码root远程访问该机器上的MySql.

相关文章:

  • 2022-01-04
  • 2021-10-24
  • 2021-12-01
  • 2021-04-02
  • 2021-11-14
猜你喜欢
  • 2021-10-28
  • 2021-06-22
  • 2021-06-13
  • 2021-11-16
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
相关资源
相似解决方案