mysql用户权限配置、添加、修改

查询mysql 有多少用户

select host, user from user;

select user from mysql.user;

创建用户

CREATE USER ‘username’@‘host’ IDENTIFIED BY ‘password’;

查看用户权限

show grants for my@localhost;

指定部分权限

grant insert,update,delete,select on *.* to mytest@localhost;

指定某个库全部权限

grant all on databasesname.* to mytest@localhost;

刷新权限

flush privileges;

设置用户密码

SET PASSWORD FOR ‘username’@‘host’ = PASSWORD(‘newpassword’);

设置当前用户

SET PASSWORD = PASSWORD(“newpassword”);

 

mysql启动报错cannot allocate memory for the buffer pool处理

     网站运行突然掉线,查看后mysql 服务停了,start 失败,查看log, 原来是无法给innodb分配足够的内存,服务器是最低配的,内存不太多,于是到/etc/mysql/my.cnf中改了如下选项:innodb_buffer_pool_size=50M 

重新start 后,mysql 正常运行。