mysql出现“Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'xxx.xxx.xx' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by”错误提示
解决方法:
vim /etc/my.cnf#添加sql_mode='NO_ENGINE_SUBSTITUTION'#重启mysqlservice mysqld restart
设置用户只能访问某一个数据库
###################################用户登录mysql服务器进行操作#####################################mysql -u root -p# 允许本地 IP 访问 localhost, 127.0.0.1insert into mysql.user(Host,User,Password) values('localhost','zhouz',password('1234'));# 允许外网 IP 访问insert into mysql.user(Host,User,Password) values('%','zhouz',password('1234'));# 刷新授权flush privileges;# 创建数据库create database zhouzdb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;# 授予用户通过外网IP对于该数据库的全部权限grant all privileges on `zhouzdb`.* to 'zhouz'@'%' identified by '1234';# 授予用户在本地服务器对该数据库的全部权限grant all privileges on `zhouzdb`.* to 'zhouz'@'localhost' identified by '1234';# 刷新权限flush privileges;# 退出 root 重新登录# 已新帐号 zhouz 登录,由于使用的是 % 任意IP连接,所以需要指定外部访问IP# mysql -u zhouz -h 192.168.1.168 -p# 1234