MySQL: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1
執行mysqldump報錯
[root@t91~]# mysqldump -d --socket=/usr/local/mysql/mysql.sock orcl_db >orcl_db.sql
mysqldump: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1': You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax to
use near 'OPTION SQL_QUOTE_SHOW_CREATE=1' at line 1 (1064)
看到報錯資訊,有說MySQL server version for the right syntax to user ....,猜測可能是工具的版本問題導致的,所以需要check 檢視mysqldump版本和路徑
[root@t91~]# mysqldump --version
mysqldump Ver 10.13 Distrib 5.1.66, for redhat-linux-gnu (x86_64)
[root@t91~]#
[root@t91~]# type mysqldump
mysqldump is hashed (/usr/bin/mysqldump)
[root@t91~]#
再檢視mysql版本是5.6.12
[root@t91~]# mysql --version
Warning: Using a password on the command line interface can be insecure.
/usr/local/mysql/bin/mysql Ver 14.14 Distrib 5.6.12, for Linux (x86_64) using EditLine wrapper
[root@t91~]#
[root@t91~]# type mysql
mysql is aliased to `/usr/local/mysql/bin/mysql -uroot --password= -S /usr/local/mysql/mysql.sock'
[root@t91~]#
看到問題所在了,mysqldump的版本和資料庫的版本不一致,/usr/bin下面的是5.1.66,/usr/local/mysql/bin/下面的是5.6.12的版本。mysql能連線到5.6.12版本的是因為做了alias對映的關係,mysqldump沒有做對映,那為啥會出現這個問題呢?看環境變數裡面的配置
[root@t91~]# more /etc/profile |grep mysql
export PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/mysql/bin
[root@t91~]#
看到了有載入/usr/bin; 和 /usr/local/mysql/bin; /usr/bin;在/usr/local/mysql/bin;的前面進行載入,所以生效的是/usr/bin下面的mysqldump。
所以解決問題的辦法有如下幾種: (1)將/usr/bin;放在/usr/local/mysql/bin;後面,重新登陸 (2)刪除/usr/bin下面的老版本的MySQL,執行命令rm -rf /usr/bin/mysql*
這裡採取的是第一種辦法,因為不知道這個老的mysql版本是否會被別的應用使用,暫時為了快速解決問題,自動載入新版本/usr/local/mysql/bin
[root@t91~]# more /etc/profile |grep mysql
export PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/root/bin:/usr/local/mysql/bin:/usr/bin
[root@t91~]#
修改完配置後,重新登陸,檢視配置,再檢視mysqldump的路徑,然後執行mysqldump操作,一切OK,如下所示:
[root@t91~]# more /etc/profile |grep mysql
export PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/root/bin:/usr/local/mysql/bin:/usr/bin
[root@t91~]#
[root@t91~]# type mysqldump
mysqldump is /usr/local/mysql/bin/mysqldump
[root@t91~]# mysqldump -d --socket=/usr/local/mysql/mysql.sock orcl_db >orcl_db.sql
[root@t91~]#
————————————————
About Me
........................................................................................................................ ● 本文作者:小麥苗,部分內容整理自網路,若有侵權請聯絡小麥苗刪除 ● 本文在itpub、部落格園、CSDN和個人微 信公眾號( xiaomaimiaolhr)上有同步更新 ● 本文itpub地址: http://blog.itpub.net/26736162 ● 本文部落格園地址: http://www.cnblogs.com/lhrbest ● 本文CSDN地址: https://blog.csdn.net/lihuarongaini ● 本文pdf版、個人簡介及小麥苗雲盤地址: http://blog.itpub.net/26736162/viewspace-1624453/ ● 資料庫筆試面試題庫及解答: http://blog.itpub.net/26736162/viewspace-2134706/ ● DBA寶典今日頭條號地址: http://www.toutiao.com/c/user/6401772890/#mid=1564638659405826 ........................................................................................................................ ● QQ群號: 230161599 、618766405 ● 微 信群:可加我微 信,我拉大家進群,非誠勿擾 ● 聯絡我請加QQ好友 ( 646634621 ),註明新增緣由 ● 於 2019-12-01 06:00 ~ 2019-12-31 24:00 在西安完成 ● 最新修改時間:2019-12-01 06:00 ~ 2019-12-31 24:00 ● 文章內容來源於小麥苗的學習筆記,部分整理自網路,若有侵權或不當之處還請諒解 ● 版權所有,歡迎分享本文,轉載請保留出處 ........................................................................................................................ ● 小麥苗的微店: https://weidian.com/s/793741433?wfr=c&ifr=shopdetail ● 小麥苗出版的資料庫類叢書: http://blog.itpub.net/26736162/viewspace-2142121/ ● 小麥苗OCP、OCM、高可用網路班: http://blog.itpub.net/26736162/viewspace-2148098/ ● 小麥苗騰訊課堂主頁: https://lhr.ke.qq.com/ ........................................................................................................................ 使用 微 信客戶端掃描下面的二維碼來關注小麥苗的微 信公眾號( xiaomaimiaolhr)及QQ群(DBA寶典)、新增小麥苗微 信, 學習最實用的資料庫技術。
........................................................................................................................ |
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26736162/viewspace-2668405/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql遇到Variable can’t be set to the value of ‘NULL’MySqlNull
- iOS:The operation couldn’t be completed. (DVTCoreSimulatorAdditionsErrorDomain eiOSErrorAI
- Flutter雜症(couldn't find "libflutter.so")Flutter
- 有用過grpc的嗎?Couldn't find descriptorRPC
- Mysql:Variable 'XXXt' can't be set to the value of 'NULL'解決MySqlNull
- Couldn‘t run wireshark in child process:許可權不夠
- MySQL:MGR 學習(1):寫集合(Write set)MySql
- _get_usbfs_fd libusb couldn‘t open the usb 許可權不夠
- Property or method “option“ is not defined on the instance but referenced during render. Make sure t
- 【已解決】報錯 NVIDIA-SMI has failed because it couldn‘t communicate with the NVIDIA driverAI
- Flutter: 解決執行時錯誤 java.lang.UnsatisfiedLinkError...couldn't find "libflutter.so"FlutterJavaError
- DtypeWarning: Columns () have mixed types. Specify dtype option on import or set low_memory=False.ImportFalse
- MongoDB 備份恢復啟動後執行操作報錯:Error:couldn't add user:not masterMongoDBErrorAST
- ERROR 1290:The MySQL server is running with the --secure-file-priv optionErrorMySqlServer
- MySQL AttributeError: ‘Engine’物件沒有’execute’屬性的錯誤MySqlError物件
- MySQL 2003 - Can’t connect to MySQL server on (10060)MySqlServer
- Hugging Face 無法連線問題 OSError: We couldn‘t connect to ‘https://huggingface.co‘ to load this file 解決方案Hugging FaceErrorHTTP
- 解決問題:Variable 'time_zone' can't be set to the value of 'NULL'Null
- Mysql-binlog日誌-TMySql
- mysql find_in_set()函式的使用MySql函式
- Failed to execute user defined function(anonfun$concatStr$1: (map<string,string>, string) => string)AIFunction
- [ERR] 1231 - Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER'SQL
- option新增空白
- T1掛分記
- 0828-T1 移除數
- T1破大防
- 2024/7/2 T1
- MySQL案例01:Last_SQL_Errno: 1755 Cannot execute the current event group in the parallel modeMySqlASTParallel
- Django Mysql SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTEDDjangoMySqlSessionMIT
- MySQL 裡的 find_in_set () 和 in () 和 likeMySql
- mysql FIND_IN_SET函式、INSTR函式MySql函式
- 相容MySQL中的find_in_set函式MySql函式
- 技術分享 | MySQL InnoDB Cluster Set 介紹MySql
- jquery獲得option的值和對option進行操作jQuery
- app:processReleaseResources, Failed to execute aaptAPPAIAPT
- [20210426]execute immediate.txt
- The option-critic architecture
- N1, T1刷機記錄