一、mysql创建用户
1、创建用户
mysql> create user test@'%' identified by '123456'; 创建了用户,但是没有任何权限
Query OK,0 rows affected (0.00sec)
mysql> grant all on *.* to root@'localhost' identified by '123456'; 没有用户,则创建用户,用户存在,就赋予权限
Query OK,0 rows affected (0.00 sec)
2、删除用户
mysql>drop user test;
Query OK,0 rows affected (0.00 sec)
3、用户的定义
1) username@’主机域’
2)主机域:可以理解为是MySQL登陆的白名单
3)主机域格式:
’10.0.0.51’
’10.0.0.5%’
’10.0.0.%’
’10.0.%.%’
’10.%.%.%’
‘%’
‘db01’
’10.0.0.51/255.255.255.0’
4、修改用户密码
[root@controller ~]# mysqladmin -uroot -p123456 password '123'; mysqladmin修改密码
mysql> grant all on *.* to root@'localhost' identified by '123456'; grant修改