天天看點

MySQL使用過程中的報錯處理(持續更新)資料庫中使用函數報錯如下導入資料報錯如下解決辦法:上述問題如果還存在則調節如下參數使用sysbench壓力測試調節threads參數為100時,報錯如下解決辦法

MySQL使用過程中的報錯處理(持續更新)

一、資料庫初始化

1、Percona的MySQL 5.6.20版本資料庫初始化

初始化指令(MySQL 5.6版本不适用mysqld指令進行初始化)

複制代碼

./scripts/mysql_install_db --defaults-file=/opt/app/mysql/my.cnf --user=mysql --basedir=/opt/app/mysql --datadir=/opt/app/mysql/data

報錯資訊如下:

FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:

Data::Dumper

解決方法是安裝autoconf庫

執行指令:yum -y install autoconf 安裝成功後繼續執行初始化指令

二、mysqldump導入資料

1、關于function的報錯

資料庫中使用函數報錯如下

ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you might want to use the less safe log_bin_trust_function_creators variable

如果我們開啟了 bin-log, 我們就必須為我們的function指定一個參數

解決辦法:

set @@global.log_bin_trust_function_creators = 1;

2、字段長度過長導緻的索引長度超出限制錯誤

導入資料報錯如下

ERROR 1071 (42000) at line 32131: Specified key was too long; max key length is 767 bytes

解決辦法:

set @@global.innodb_large_prefix = ON

上述問題如果還存在則調節如下參數

ERROR 1709 (HY000) at line 32131: Index column size too large. The maximum column size is 767 bytes.

set @@global.innodb_file_format_max = Barracuda; //預設的值為Antelope

set @@global.innodb_file_format = Barracuda ;

3、sysbench壓力測試MySQL的QPS&&TPS報錯

使用sysbench壓力測試調節threads參數為100時,報錯如下

FATAL: `thread_init' function failed: /usr/share/sysbench/oltp_common.lua:284: SQL API error

FATAL: MySQL error: 1461 "Can't create more than max_prepared_stmt_count statements (current value: 16382)"

(last message repeated 3 times)

解決辦法

在使用sysbench壓力測試的時候 并發線程達到100的時候報錯,max_prepared_stmt_count參數限制了同一時間在mysqld上所有會話中的prepare語句的上限,它的取值範圍為“0--1048576”,預設值為16382,超出這個值的prepare語句會報1461錯誤

set global max_prepared_stmt_count=1048576; //不建議調節,線程數給到16或者32就可以滿足壓力測試提供參考依據的目的

原文位址

https://www.cnblogs.com/liyingxiao/p/10729699.html