数据库管理软件(Navicat)及其遇到的问题

软件安装

软件使用

  • 点击连接
    在这里插入图片描述
    输入passward,就可以连接数据库了

遇到的问题
如果数据库连不上,出现了2059的错误,则进行一下操作

  • 命令行进入数据库
mysql -u root -p
  • 查看用户的host名称
use mysql;
select user,authentication_string,host from user where user='root';

在这里插入图片描述
如果host不是%,则设置为%,确保可以让任意IP使用数据库。

update user set host = '%' where user = 'root';
  • 然后mysql用户登录密码加密规则还原成mysql_native_password
ALTER USER 'root'@'%' IDENTIFIED BY '<yourpassword>' PASSWORD EXPIRE NEVER; #修改加密规则 
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '<yourpassword>'; #更新一下用户的密码 
FLUSH PRIVILEGES; #刷新权限
  • 重启mysql
mysqld --console
  • 重新使用Navicat for MySQL登陆
    在这里插入图片描述

使用过程遇到的问题

执行语句时总是报错[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c

这是因为sql_mode设置导致的这个错误。

可以查看自己的sql_mode设置;

show variables like "sql_mode";

在这里插入图片描述

查看是否有only_full_group_by

如果有only_full_group_by,打开my.ini文件(或者my.cnf)修改, 去掉only_full_group_by

sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"

然后重启mysql

posted on 2018-10-24 09:13  一小白  阅读(674)  评论(0编辑  收藏  举报