mysql5.7 用户表操作

来源:互联网 发布:如何卸载mac上的软件 编辑:程序博客网 时间:2024/05/17 04:40

1.创建一个用户
  CREATE USER username@localhost IDENTIFIED BY '123456';
  ( username 表示用户名,localhost为是来源的主机,%表示所有主机都可以访问)
2.赋予权限
  grant all privileges on dbname.* to username@'%'
  (dbname.*   赋予dbname 这个这个数据库所有的表权限给username )
3.修改用户权限,让远程主机登录mysql
    use mysql;
    update user set host = '%' where user ='root';
4.以上最后都要 让其生效
    flush privileges;

附:http://blog.csdn.net/wengyupeng/article/details/3290415
http://blog.chinaunix.net/uid-9554532-id-2000700.html
http://my.oschina.net/leejun2005/blog/678202

http://my.oschina.net/u/573270/blog/423238

5.update mysql.user set authentication_string=password('xiaojiashi@XJS12076') where user='hteacher';
0 0
原创粉丝点击