Python - - MySQL数据库 - - 报错锦集
Posted 小Q渺晓
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python - - MySQL数据库 - - 报错锦集相关的知识,希望对你有一定的参考价值。
- 注:环境配置信息,系统环境CentOS 7.4,数据库版本 mysql-5.7.24
1,跳过授权表
# 在命令行跳过授权表命令
mysqld_safe --skip-grant-tables &
# 在 my.cnf 文件配置跳过授权表命令
[mysqld]
skip-grant-tables
2,更改root密码
# 方法一:
update mysql.user set authentication_string=password(‘root‘) where user=‘root‘ and host=‘localhost‘;
flush privileges;
# 报错如下:使用方法二
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
# 方法二:
alter user user() identified by "root";
flush privileges;
3,创建新用户并授权
# 授权本地登录
grant all privileges on *.* to [email protected] identified by ‘test‘;
# 授权远程登录
grant all privileges on *.* to [email protected]‘%‘ identified by ‘test‘;
4, 通过 Navicat 创建数据库报错
# 报错如下
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘information_schema.PROFILING.SEQ‘ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
# 查询
select version(), @@sql_mode;
# 修改
SET sql_mode=(SELECT REPLACE(@@sql_mode,‘ONLY_FULL_GROUP_BY‘,‘‘));
5,查死锁
show engine innodb status G;
select * from information_schema.INNODB_TRX;
以上是关于Python - - MySQL数据库 - - 报错锦集的主要内容,如果未能解决你的问题,请参考以下文章
python向mysql插入数据一直报TypeError: must be real number,not str
Django启动报错Did you install mysqlclient or MySQL-python