首页 > 技术文章 > mysql常用操作

30go 原文

1. 给数据库添加登录用户和权限

# 创建用户
create
user 'ecsoft' identified by 'ecsoft';

# grant all privileges on 库名.表名 to '用户名'@'IP地址' identified by '密码' with grant option;
grant all privileges on ecsoft.* to ecsoft@"localhost" identified by 'ecsoft';

//后面在使用过程中,发现指定单个数据库权限的时候,经常连接不上。后面改成所有的数据库连接就可以。
grant all privileges on *.* to ecsoft@"localhost" identified by 'ecsoft';


# 提交 flush
privileges;

推荐阅读