第一种:mysql 5.0(两种方式)

一、

在命令窗口输入,mysql -u root -p  回车,并输入密码

执行 use mysql

执行下面句子,查看权限,root默认权限为localhost

select user,host from user;

更改root权限为%

update user set host = '%' where user = 'root';

刷新

flush privileges;

二、

在命令窗口输入,mysql -u root -p  回车,并输入密码

执行 use mysql

设置test为账户,密码为:ceshipwd,权限为%,所有人

grant all on *.*  to 'test'@'%' identified by 'ceshipwd';

如果权限不设置为所有人,可设定固定访问IP如下:

grant all on *.*  to 'test'@'111.111.111.111' identified by 'ceshipwd';

最后,刷新

flush privileges;

第一种:mysql 8.0以上(两种方式)

一、

在命令窗口输入,mysql -u root -p  回车,并输入密码

执行 use mysql

执行下面句子,查看权限,root默认权限为localhost

select user,host from user;

更改root权限为%

update user set host = '%' where user = 'root';

刷新

flush privileges;

二、

在命令窗口输入,mysql -u root -p  回车,并输入密码

执行 use mysql

设置test为账户,密码为:ceshipwd,权限为%,所有人

先建立账号:

create user 'test'@'%' identified with mysql_native_password by 'ceshipwd';

再添加账号权限

grant all on *.*  to 'test'@'%';

如果权限不设置为所有人,可设定固定访问IP如下:

grant all on *.*  to 'test'@'111.111.111.111';

最后,刷新

flush privileges;

三、

各版本修改密码的格式:

mysql5.0格式如下:

本地可以访问

alter user 'ceshi'@'localhost' identified   by 'ceshipw';

所有都可以访问

alter user 'ceshi'@'%' identified   by 'ceshipw';

mysql8.0以上格式如下:

本地可以访问

alter user 'ceshi'@'localhost' identified with mysql_native_password  by 'ceshipw';

所有都可以访问

alter user 'ceshi'@'%' identified  with mysql_native_password by 'ceshipw';

*使用navicat连接mysql8.0数据库时,提示1251-client does not support authentication protocol requested by server;consider upgrading mysql client 解决办法:

进入数据库,更新一下认证格式
user mysql;
#下面方式是修改密码的格式,即可正常访问
alter user 'ceshi'@'%' identified with mysql_native_password by 'ceshipw';
flush privileges;

最新文章

  1. Android系列之Fragment(四)----ListFragment的使用
  2. SqlServer关闭与启用标识(自增长)列
  3. mysql命令整理0919 不定期更新中
  4. ERROR 1045 (28000): Access denied for user root@localhost (using password:
  5. 远程重启linux主机的几种方法
  6. Apache Shiro 使用手册---转载
  7. DataSnap与FireDAC三层
  8. ASP.NET MVC 开篇
  9. 从文章"避免复制与粘贴"到文章"Extract Method"的反思(2)
  10. 新发现:AirDroid(用Web端控制自己的手机发信息)
  11. 1.2 Coin 项目
  12. 2013 长沙网络赛 B 题 Bizarre Routine
  13. asp.net 超链接 下载TEXT文件,而不是直接在IE中打开
  14. BootStrap 智能表单系列 十一 级联下拉的支持
  15. php的迭代器
  16. 用命令行使用soot反编译生成jimple
  17. python中网络编程之线程
  18. SpringBoot2.x整合Redis实战 4节课
  19. Mysql优化要点
  20. Codeforces 954C Matrix Walk (思维)

热门文章

  1. SpringCloud升级之路2020.0.x版-18.Eureka的客户端核心设计和配置
  2. 真.OI宝典
  3. 【gdal】创建GeoTiff栅格数据
  4. JavaWeb学习总结—Session
  5. Fllink学习
  6. Golang slice作为函数参数
  7. mybaits源码分析--类型转换模块(三)
  8. ubuntu下安装teamiewer
  9. 虚拟机VMWare开机黑屏 无法进入系统
  10. 接口自动化-python+requests+pytest+csv+yaml