mysql8.*安装完成,接下来改配置远程权限,sql模式。
1.远程权限: mysql8默认只支持本地连接。
登录 mysql: mysql -uroot -p; 查看进入mysql database: use mysql;
查看当前用户信息 : select host,user, authentication_string, plugin from user;
里面host全为'localhost',对于开发人员远程Navicat登录来讲肯定不行。如果将user表host字段全部改为'%'可行,但这样做真心不好。
(1)新建用户:
CREATE USER 'your_name'@'your_host' IDENTIFIED WITH mysql_native_password BY 'your_pass'; your_name即为Navicat登录账号,your_pass即为登录密码,your_host即Navicat连接弹出的'xxx.xx.xx.xxx'无法连接。把'xxx'记录下来就是。
这样做的好处是给不同的网络环境配置不同的连接属性(包括database,table权限)。这样可以有效的管理多人开发账号使用!
(2)授权用户:
GRANT ALL PRIVILEGES ON *.* TO 'your_name'@'your_host';
即 授权 该用户(your_name @ your_host) 所有权限到 *.*(all_database.all_table)
最后刷新权限:FLUSH PRIVILEGES;
2.sql模式(sql_mode):
mysql被oracle收购后,规则要靠齐。
oracle的group by 使用的非常严谨,即select项 要么是聚合项 要么是group by项,从个人开发角度这样很难受。。。
查看:
show global variables like 'sql_mode'; show session variables like 'sql_mode';
需要删除'ONLY_FULL_GROUP_BY'。从你查询出的结果,复制保存value,将里面的 ONLY_FULL_GROUP_BY去掉。然后
set session sql_mode='new_sql_mode';set global sql_mode='new_sql_mode';