mariaDB grant privileges

#copy form my sina blog http://blog.sina.com.cn/s/blog_67c902bd0102w79z.html

>create user MyTest identified by '123456'

#grant privileges
>grant all privileges on *.* 
to 'MyTest'@'%'identified by '123456' with grant option
##grant all privileges on *.*  to 'MyTest'@'%'identified by '123456' with grant option
##grant all privileges on *.*  to'MyTest'@'192.168.1.1'identified by '123456'  withgrant option
##grant all privileges on *.*  to'MyTest'@'192.168.1.%' identified by '123456' with grantoption
##grant all privileges on *.*  to'MyTest'@'localhost' identified by '123456' with grant option
##grant all privileges on dbName.tableName  to'userName'@'host' identified by '123456' with grant ###option
##GRANT SELECT, INSERT, UPDATE, DELETE ON websites TO'techonthenet'@'localhost' identified by ##'123456' with grantoption;
####NOTE: with grant option means that  allows youto grant the privileges that you possess to other ####users. if youdon't add this option ,you can't grant the privileges to otherusers,if you have not ####add "identified by '123456'" ,it maybetake error "error 1133[42000] can't find match row...."
# select current user
>select user();
#select users
>use mysql;
>select user[,host] from user;
#show current user databases;
>show databases;
#show current user database tables
>show tables;

###########################################################
FAQ:ERROR 1044 (42000):Access denied for user ''@'localhost'(using password: YES)
reslove:skip grant tables and use mysql to update the record wherehost value is localhost

#>service mysqld stop
#>mysqld_safe --skip-grant-tables
#mysql>mysql
#mysql>use mysql
#mysql>update user set user=root,password=password("123456")where host="localhost";
#mysql>flush privileges;
#mysql>exit ;
#mysql -h 127.0.0.1 -u root -p
#mysql>use mysql
#mysql>grant all privileges on *.* to 'root'@'localhost'identified by '123456' with grant option
#mysql>exit;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值