【MySQL】Testing mysql connection and privileges..ERROR 1173 (42000)
今天一同事弄MHA,在檢查複製時,出現了問題,本公司的版本是mariadb10.1版本,具體現象如下:
Checking slave recovery environment settings..
Opening /apps/dbdat/mariadb10.1_data3306/relay-log.info ... ok.
Relay log found at /apps/dbdat/mariadb10.1_data3306, up to relay-bin.000002
Temporary relay log file is /apps/dbdat/mariadb10.1_data3306/relay-bin.000002
Testing mysql connection and privileges..ERROR 1173 (42000) at line 1: This table type requires a primary key
mysql command failed with rc 1:0!
at /apps/sh/mha/mha_node/bin/apply_diff_relay_logs line 375.
main::check() called at /apps/sh/mha/mha_node/bin/apply_diff_relay_logs line 497
eval {...} called at /apps/sh/mha/mha_node/bin/apply_diff_relay_logs line 475
main::main() called at /apps/sh/mha/mha_node/bin/apply_diff_relay_logs line 120
Sat Jun 4 09:24:48 2016 - [error][/apps/lib/mha/mha_manager/MHA/MasterMonitor.pm, ln205] Slaves settings check failed!
Sat Jun 4 09:24:48 2016 - [error][/apps/lib/mha/mha_manager/MHA/MasterMonitor.pm, ln413] Slave configuration failed.
Sat Jun 4 09:24:48 2016 - [error][/apps/lib/mha/mha_manager/MHA/MasterMonitor.pm, ln424] Error happened on checking configurations. at /apps/sh/mha/mha_manager/bin/masterha_check_repl line 48.
Sat Jun 4 09:24:48 2016 - [error][/apps/lib/mha/mha_manager/MHA/MasterMonitor.pm, ln523] Error happened on monitoring servers.
Sat Jun 4 09:24:48 2016 - [info] Got exit code 1 (Not master dead).
分析:這裡是檢查檢查連線和許可權時的報錯,於是找到apply_diff_relay_logs的375行
具體檢測的語句如下:
Checking slave recovery environment settings..
Opening /apps/dbdat/mariadb10.1_data3306/relay-log.info ... ok.
Relay log found at /apps/dbdat/mariadb10.1_data3306, up to relay-bin.000002
Temporary relay log file is /apps/dbdat/mariadb10.1_data3306/relay-bin.000002
Testing mysql connection and privileges..ERROR 1173 (42000) at line 1: This table type requires a primary key
mysql command failed with rc 1:0!
at /apps/sh/mha/mha_node/bin/apply_diff_relay_logs line 375.
main::check() called at /apps/sh/mha/mha_node/bin/apply_diff_relay_logs line 497
eval {...} called at /apps/sh/mha/mha_node/bin/apply_diff_relay_logs line 475
main::main() called at /apps/sh/mha/mha_node/bin/apply_diff_relay_logs line 120
Sat Jun 4 09:24:48 2016 - [error][/apps/lib/mha/mha_manager/MHA/MasterMonitor.pm, ln205] Slaves settings check failed!
Sat Jun 4 09:24:48 2016 - [error][/apps/lib/mha/mha_manager/MHA/MasterMonitor.pm, ln413] Slave configuration failed.
Sat Jun 4 09:24:48 2016 - [error][/apps/lib/mha/mha_manager/MHA/MasterMonitor.pm, ln424] Error happened on checking configurations. at /apps/sh/mha/mha_manager/bin/masterha_check_repl line 48.
Sat Jun 4 09:24:48 2016 - [error][/apps/lib/mha/mha_manager/MHA/MasterMonitor.pm, ln523] Error happened on monitoring servers.
Sat Jun 4 09:24:48 2016 - [info] Got exit code 1 (Not master dead).
分析:這裡是檢查檢查連線和許可權時的報錯,於是找到apply_diff_relay_logs的375行
具體檢測的語句如下:
"$_mysql --user=$_escaped_slave_user --password=$_escaped_slave_pass --host=$opt{slave_ip} --port=$opt{slave_port} -e \"set sql_log_bin=0; create table if not exists mysql.apply_diff_relay_logs_test(id int); insert into mysql.apply_diff_relay_logs_test values(1); update mysql.apply_diff_relay_logs_test set id=id+1 where id=1; delete from mysql.apply_diff_relay_logs_test; drop table mysql.apply_diff_relay_logs_test;
確實有建立表,沒有指定主鍵
但是沒主鍵 建表應該是不報錯的呀?
突然想到mariadb10.1的版本是強制要求主鍵的,至此問題的原因找到
解決辦法(找到了原因,一切迎刃而解):
1.修改innodb_force_primary_key的值為off。
2.修改MHA的檢測語句,加上主鍵。
確實有建立表,沒有指定主鍵
但是沒主鍵 建表應該是不報錯的呀?
突然想到mariadb10.1的版本是強制要求主鍵的,至此問題的原因找到
MariaDB [(none)]> show variables like '%primary%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| innodb_force_primary_key | ON |
+--------------------------+-------+
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| innodb_force_primary_key | ON |
+--------------------------+-------+
解決辦法(找到了原因,一切迎刃而解):
1.修改innodb_force_primary_key的值為off。
2.修改MHA的檢測語句,加上主鍵。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30221425/viewspace-2113845/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql connection refusedMySql
- MySQL:Lost connection to MySQL server at 'readingMySqlServer
- 【Mysql】MySql Host is blocked because of many connection errors;MySqlBloCError
- Jmeter mysql testing遇到的問題JMeterMySql
- Check connection related issue of mysqlMySql
- Dr.Elephant mysql connection errorMySqlError
- Mysql連線錯誤:Mysql Host is blocked because of many connection errorsMySqlBloCError
- Dr.Elephant mysql connection error薦MySqlError
- 【MySQL】Host is blocked because of many connection errorsMySqlBloCError
- MySQL:ERROR 1286 (42000): Unknown storage engine 'MyISAM'MySqlError
- ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'ErrorlocalhostDatabaseMySql
- Mysql mysql lost connection to server during query 問題解決方法MySqlServer
- mysql5.5_2013 Lost connection to Mysql server during queryMySqlServer
- MySQL 5.5 報錯"ERROR 1075 (42000): Incorrect table definition"MySqlError
- Lost connection to MySQL server at 'reading authorization packet'MySqlServer
- Mysql 如何更改default collation_connection settingMySql
- Mysql連線錯誤:Lost connection to Mysql server at 'waiting for initial communication packet'MySqlServerAI
- Software caused connection abort: socket write error/mysql/tomcatErrorMySqlTomcat
- mysql:max_connection的設定及優化MySql優化
- MySQL報錯ERROR 2013 (HY000): Lost connection to MySQL server during queryMySqlErrorServer
- MySQL 8.0.26 bug ERROR 1064(42000) -master-data is deprecated and will be removeMySqlErrorASTREM
- Mysql host is blocked because of many connection errors;unblock解決方法MySqlBloCError
- MySQL異常刨析:ata source rejected establishment of connection, message from server: “Too many connectionMySqlServer
- mysql的ERROR 1231 (42000)問題原因及解決方法MySqlError
- Mac 下的MySQL ERROR 1227(42000): Access denied; you need (at least one of)MacMySqlErrorAST
- mysql會話控制限制登入次數(connection_control外掛)MySql會話
- Lost connection to MySQL server at ‘reading initial communication packet', system error: 0 mysql遠端連線問題MySqlServerError
- Java專案連線資料庫Mysql報錯create connection SQLExceptionJava資料庫MySqlException
- mysqldump: Error 2013: Lost connection to MySQL server during query when dumpingMySqlErrorServer
- Percona MySQL 日誌中出現大量Aborted connection (Got an error reading)MySqlGoError
- ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization paErrorMySqlServer
- Testing
- MySQL_ERROR 1231 (42000) at line XX in file 'file_name' Variable 'time_zone' can't beMySqlError
- Zabbix 2.2安裝MySQL MPM外掛報錯'Connection to zabbix server failed (rc=1305)'MySqlServerAI
- 【Mysql】MySQL管理工具MySQL UtilitiesMySql
- MySQL - 初識MySQLMySql
- 【MySQL】MySQL基礎MySql
- 【MySQL】MySQL 5.7 初探MySql