MySQL入門學習之——MySQL錯誤解決彙總
以下都是工作中使用MySQL過程中遇到的一些錯誤,特記錄之。
錯誤1:在執行mysql時 提示如下錯誤:
ERROR 1580 (HY000) at line 1: You cannot 'DROP' a log table if logging is enabled”
解決方法:執行set global slow_query_log=off,然後再次執行mysql
錯誤2:在執行innobackupex時報如下錯誤:
innobackupex: Error: Failed to connect to MySQL server: DBI connect(';mysql_read_default_file=/mvnobss/users/mysusr01/mysql/bin/my.cnf;mysql_read_default_group=xtrabackup;port=39301;
mysql_socket=/mvnobss/users/mysusr01/mysql/mydata/mysqld-hdh-vocrmdb1-39301.sock','root',...) failed: Can't connect to local MySQL server through socket '/mvnobss/users/mysusr01/mysql/mydata/mysqld-hdh-vocrmdb1-39301.sock'
解決方法:執行innobackupex備份的使用者需要對MySQL資料目錄有讀取許可權,並且對socket檔案有讀寫許可權
錯誤3:java應用報連線異常,錯誤資訊如下:
cause: com.binary.jdbc.exception.DataSourceException: Cannot create PoolableConnectionFactory (null, message from server: "Host '10.123.121.252' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'")
解決方法:mysqladmin -uroot -p flush-hosts
錯誤4:執行mysqldump報如下錯誤:
mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `res_card_storage_detail` at row: 510319
解決方法:將引數net_write_timeout的值加大(網上搜尋的解決方法)
修改後問題依舊,透過觀察系統日誌發現有如下重要資訊:
Jul 6 17:29:25 yt-votst1 kernel: Out of memory: Kill process 16398 (mysqld) score 44 or sacrifice child
Jul 6 17:29:25 yt-votst1 kernel: Killed process 16398, UID 312, (mysqld) total-vm:5289288kB, anon-rss:1352100kB, file-rss:768kB
接著檢視系統記憶體設定:
free -m
total used free shared buffers cached
Mem: 29970 29830 139 0 169 224
-/+ buffers/cache: 29436 533
Swap: 0 0 0
結論:所以這裡mysqldump報錯的真正原因是沒有設定swap導致mysqld程式記憶體溢位,設定swap後mysqldump執行正常。
錯誤5:mysql.user表資料被清空
解決方法:
1.在my.cnf中加入skip-grant-tables,然後重啟myqld
2.插入資料到myql.user表
mysql> insert into user(host,user,password) values('localhost','root',password('123'));
ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value
3.上面報錯是因為sql_mode中有STRICT_TRANS_TABLES選項,去掉該選項然後重啟mysqld
4.執行下面的sql
mysql> insert into user(host,user,password) values('localhost','root',password('123'));
mysql> update user set select_priv='y', insert_priv='y',update_priv='y',Alter_priv='y',delete_priv='y',create_priv='y',drop_priv='y',reload_priv='y',shutdown_priv='y',Process_priv='y',file_priv='y',grant_priv='y',References_priv='y',index_priv='y',create_user_priv='y',show_db_priv='y',super_priv='y',create_tmp_table_priv='y',Lock_tables_priv='y',execute_priv='y',repl_slave_priv='y',repl_client_priv='y',create_view_priv='y',show_view_priv='y',create_routine_priv='y',alter_routine_priv='y',create_user_priv='y' where user='root';
mysql> commit;
5.去掉skip-grant-tables引數,然後重啟mysqld
錯誤1:在執行mysql時 提示如下錯誤:
ERROR 1580 (HY000) at line 1: You cannot 'DROP' a log table if logging is enabled”
解決方法:執行set global slow_query_log=off,然後再次執行mysql
錯誤2:在執行innobackupex時報如下錯誤:
innobackupex: Error: Failed to connect to MySQL server: DBI connect(';mysql_read_default_file=/mvnobss/users/mysusr01/mysql/bin/my.cnf;mysql_read_default_group=xtrabackup;port=39301;
mysql_socket=/mvnobss/users/mysusr01/mysql/mydata/mysqld-hdh-vocrmdb1-39301.sock','root',...) failed: Can't connect to local MySQL server through socket '/mvnobss/users/mysusr01/mysql/mydata/mysqld-hdh-vocrmdb1-39301.sock'
解決方法:執行innobackupex備份的使用者需要對MySQL資料目錄有讀取許可權,並且對socket檔案有讀寫許可權
錯誤3:java應用報連線異常,錯誤資訊如下:
cause: com.binary.jdbc.exception.DataSourceException: Cannot create PoolableConnectionFactory (null, message from server: "Host '10.123.121.252' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'")
解決方法:mysqladmin -uroot -p flush-hosts
錯誤4:執行mysqldump報如下錯誤:
mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `res_card_storage_detail` at row: 510319
解決方法:將引數net_write_timeout的值加大(網上搜尋的解決方法)
修改後問題依舊,透過觀察系統日誌發現有如下重要資訊:
Jul 6 17:29:25 yt-votst1 kernel: Out of memory: Kill process 16398 (mysqld) score 44 or sacrifice child
Jul 6 17:29:25 yt-votst1 kernel: Killed process 16398, UID 312, (mysqld) total-vm:5289288kB, anon-rss:1352100kB, file-rss:768kB
接著檢視系統記憶體設定:
free -m
total used free shared buffers cached
Mem: 29970 29830 139 0 169 224
-/+ buffers/cache: 29436 533
Swap: 0 0 0
結論:所以這裡mysqldump報錯的真正原因是沒有設定swap導致mysqld程式記憶體溢位,設定swap後mysqldump執行正常。
錯誤5:mysql.user表資料被清空
解決方法:
1.在my.cnf中加入skip-grant-tables,然後重啟myqld
2.插入資料到myql.user表
mysql> insert into user(host,user,password) values('localhost','root',password('123'));
ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value
3.上面報錯是因為sql_mode中有STRICT_TRANS_TABLES選項,去掉該選項然後重啟mysqld
4.執行下面的sql
mysql> insert into user(host,user,password) values('localhost','root',password('123'));
mysql> update user set select_priv='y', insert_priv='y',update_priv='y',Alter_priv='y',delete_priv='y',create_priv='y',drop_priv='y',reload_priv='y',shutdown_priv='y',Process_priv='y',file_priv='y',grant_priv='y',References_priv='y',index_priv='y',create_user_priv='y',show_db_priv='y',super_priv='y',create_tmp_table_priv='y',Lock_tables_priv='y',execute_priv='y',repl_slave_priv='y',repl_client_priv='y',create_view_priv='y',show_view_priv='y',create_routine_priv='y',alter_routine_priv='y',create_user_priv='y' where user='root';
mysql> commit;
5.去掉skip-grant-tables引數,然後重啟mysqld
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20801486/viewspace-2089341/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql錯誤解決總結MySql
- MySQL入門學習之——innodb lockMySql
- 【MySQL】解決mysql的 1594 錯誤MySql
- MySQL入門學習之——實戰XtraBackupMySql
- MySQL入門學習之——實戰mysqldumpMySql
- 【Mysql學習】mysql的使用入門MySql
- 【Mysql 學習】mysql 的使用入門MySql
- mysql與php錯誤解決MySqlPHP
- MySQL入門學習之——原始碼安裝mysql5.5MySql原始碼
- MySQL入門學習之——mysql與oracle死鎖對比MySqlOracle
- MySQL常見錯誤分析與解決方法總結MySql
- service mysql start出錯,mysql啟動不了,解決mysql: unrecognized service錯誤MySqlZed
- mysql報錯程式碼彙總MySql
- 寬頻連線錯誤解決方法總彙
- MySQL學習筆記---入門使用MySql筆記
- mysql 基礎命令入門學習MySql
- Java入門學習手冊之Eclipse常用快捷鍵彙總JavaEclipse
- MySQL錯誤之mysql.slave_master_infoMySqlAST
- 解決MySQL server has gone away錯誤的解決方案MySqlServerGo
- MYSQL中 TYPE=MyISAM 錯誤的解決方法MySql
- MySQL插入資料1366錯誤解決方案MySql
- MySQL錯誤Incorrect file format解決方案薦MySqlORM
- mysql匯入報錯怎麼解決?MySql
- mysql安裝/啟動報錯彙總MySql
- MongoDB 錯誤彙總MongoDB
- Git錯誤彙總Git
- MySQL學習筆記之命令總結MySql筆記
- 解決Mysql錯誤[1040]Too many connectionsMySql
- mysql insert語句錯誤問題解決MySql
- mysql master-slave複製錯誤[解決事例]MySqlAST
- Mysql出現連線錯誤解決辦法MySql
- MySQL工具彙總MySql
- MYSQL學習總結MySql
- 《學習Oracle從這裡開始》之解決錯誤篇Oracle
- 重新學習Mysql資料庫1:無廢話MySQL入門MySql資料庫
- Mysql學習筆記2--使用入門MySql筆記
- MySQL-學習-快速入門/注入攻擊MySql
- mysql 解決字符集錯誤 正確摘錄MySql