一、資料庫初始化
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就可以滿足壓力測試提供參考依據的目的
希望與廣大網友互動??
點此進行留言吧!