首页 > 数据库 >mysql版本:'for the right syntax to use near 'identified by 'password' with grant o

mysql版本:'for the right syntax to use near 'identified by 'password' with grant o

时间:2023-06-05 22:02:15浏览次数:55  
标签:use right option grant identified password mysql 权限

查询mysql具体版本

SELECT @@VERSION

问题分析:mysql版本8.0.13,在给新用户授权时,发生了变化:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by  'password' with grant option' at line 5, Time: 0.000000s

出错的语句:

grant all privileges on *.* to 'root'@'172.16.10.203' identified by  'password' with grant option

修正后的语句:分开三次执行

#创建账户
create user 'root'@'172.16.10.203' identified by  'password'

#赋予权限,with grant option这个选项表示该用户可以将自己拥有的权限授权给别人
grant all privileges on *.* to 'root'@'172.16.10.203' with grant option

#改密码&授权超用户,flush privileges 命令本质上的作用是将当前user和privilige表中的用户信息/权限设置从mysql库(MySQL数据库的内置库)中提取到内存里
flush privileges;

 

原因分析 :此版的的mysql版本把将创建账户和赋予权限分开了。

创建账户::create user ‘用户名’@‘访问主机’ identified by ‘密码’;
赋予权限:grant 权限列表 on 数据库 to ‘用户名’@‘访问主机’ ;
with grant option这个选项表示该用户可以将自己拥有的权限授权给别人



标签:use,right,option,grant,identified,password,mysql,权限
From: https://blog.51cto.com/u_4018548/6419794

相关文章

  • 使用fake-useragent自动更换UserAgent
    安装:pipinstallfake-useragent使用:fromfake_useragentimportUserAgentif__name__=='__main__':agent__random=UserAgent().randomprint(str(agent__random))如果报错:fake_useragent.errors.FakeUserAgentError本地UserAgent和远程UserAgent不一致导致,同步一下......
  • opensuse安装报错
    用u盘安装opensuse时,报错:YaST2Cannotaccessinstallationmediahd:/?device=/dev/disk/by-id/usb-xxx-part1hd-xxx(Medium1).Checkwhethertheserverisaccessible.是因为烧录启动盘时,不知什么原因,有些文件没有拷贝全,可以挂载opensuse的ios,然后把所有文件拷贝到u盘,跳......
  • const { t } = useI18n();不能在setup外执行
    传递函数constchartOptions=(t:Function,color:string="warning",height:string="auto"):ApexOptions=>{return{//Restofyourchartoptionscategories:[t("Totalnumber"),t("normal"),&......
  • User-Agent特征库
    User-Agent特征库爬行特征库(CRAWLERS)008ABACHOBotAccoona-AI-AgentAddSugarSpiderBotAnyApexBotArachmoB-l-i-t-z-B-O-TBaiduspiderBecomeBotBeslistBotBillyBobBotBimbotBingbotBlitzBOTboitho.com-dcboitho.com-robotbtbotCatchBotCerberianDrtrsCharlott......
  • pnpm:无法加载文件 C:\Users\Five\AppData\Roaming\npm\pnpm.ps1 ,因为在此系统
    前言重装完了电脑系统,运行pnpm无法加载文件,pnpm-V也不行解决方案用管理员方式启动powershell输入命令:set-ExecutionPolicyRemoteSigned然后再输入:Y重启代码编辑器 ......
  • 微软Playwright-UI自动化中常用方法总结-java
    经过多天对微软自动化框架Playwright的使用,发现还没有讲该框架的常用方法,比如定位、按键等操作使用。今天我们正好来说说。  一、鼠标类操作     1.单点      .click();   click(Stringselector){                          ......
  • 解决 NVIDIA Windows has stopped this device because it has reported problems. (C
    场景当跑需要使用GPU算力的一些项目时候,需要用到CUDA,确保电脑是具有独立显卡的机子,但是怎么也没法让代码中的torch跑在GPU上;点击任务管理器查看"性能"下的GPU选项,看到运行中的并非是独立显卡而是集成显卡;点击设备管理器,发现NVIDIA显卡左下角有感叹号,双击发现里面显示"Wind......
  • 首次进入Mysql修改密码报“The MySQL server is running with the --skip-grant-table
    第一次安装完mysql,修改默认密码的时候,报“TheMySQLserverisrunningwiththe--skip-grant-tablesoptionsoitcannotexecutethisstatement”。先刷新mysql然后再重新修改密码即可。mysql>ALTERUSER'root'@'localhost'IDENTIFIEDBY'123456';ERROR1290(H......
  • ARL(Asset Reconnaissance Lighthouse)资产侦察灯塔系统
    ARL(AssetReconnaissanceLighthouse)资产侦察灯塔系统   资产灯塔,不仅仅是域名收集简介旨在快速侦察与目标关联的互联网资产,构建基础资产信息库。协助甲方安全团队或者渗透测试人员有效侦察和检索资产,发现存在的薄弱点和攻击面。在开始使用之前,请务必阅读并同意免责声......
  • anaconda运行install命令报错:Caused by SSLError(SSLCertVerificationError(1, '[SSL:
      运行命令:condainstallmpi4py 报错:Retrievingnotices:...working...ERRORconda.notices.fetch:get_channel_notice_response(63):Requesterror<HTTPSConnectionPool(host='mirrors.tuna.tsinghua.edu.cn',port=443):Maxretriesexceededwithurl......