mysql常用操作

2021/7/13 19:35:53

本文主要是介绍mysql常用操作,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

一.创建用户

  • 执行任何IP的yuhaohao用户登录
    create user 'yuhaohao'@'%' identified by '123456';

  • 执行指定IP的yuhaohao用户登录
    create user 'yuhaohao'@'192.118.1.1' identified by '123456';

二.用户数据库权限操作

  • yuhaohao用户对所有数据库中文件有任何操作
    grant all privileges on . to "yuhaohao"@'%';

表示有所有的权限,除了grant这个命令,这个命令是root才有的。yuhaohao用户对test下的table1文件任意操作权限

grant all privileges on test.table1 to "yuhaohao"@'%';

yuhaohao用户对test数据库中的文件执行任何操作

grant all privileges on test.* to "yuhaohao"@'%';



这篇关于mysql常用操作的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程