1. 程式人生 > >Python - - MySQL數據庫 - - 報錯錦集

Python - - MySQL數據庫 - - 報錯錦集

aggregate state sql lec cat root navi using exec

  • :環境配置信息,系統環境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 test@localhost identified by ‘test‘;

# 授權遠程登錄
grant all privileges on *.* to test@‘%‘ 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數據庫 - - 報錯錦集