mysql安装用户设置
xmapp安装后设置MariaDB问题
创建用户
insert into mysql.user(Host,User,Password) values("localhost","phplamp",password("1234"));
创建用户并分配所有权限
grant all privileges on dbname.* to 'username'@'%' identified by 'password';//
创建用户并分配权限
grant select,update on phplampDB.* to phplamp@localhost identified by '1234';
//修改用户密码
update mysql.user set password=password('新密码') where User="root" and Host="localhost";
删除用户指定权限
revoke insert,update,delete,select ON *.* from 'test'@'localhost' IDENTIFIED BY '123';
遇到的问题
- 设置一个用户无法链接,解决方法:
查询如果有,然后通过
select * from mysql.user where user='';
删除了多余的空白账户, 然后,通过
use mysql; delete from user where user = '';
重载一次权限表,最后用
flush privileges;
service mysqld restart