1. 程式人生 > >mysql 5.5升級5.6報錯:ERROR 1193 (HY000) at line 84: Unknown system variable 'have_csv'

mysql 5.5升級5.6報錯:ERROR 1193 (HY000) at line 84: Unknown system variable 'have_csv'

首先登陸資料庫沒有問題呀,但是有報錯,

文字顯示:

ERROR 1193 (HY000) at line 84: Unknown system variable 'have_csv'
ERROR 1064 (42000) at line 86: 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 'NULL' at line 1
ERROR 1243 (HY000) at line 87: Unknown prepared statement handler (stmt) given to EXECUTE
ERROR 1243 (HY000) at line 88: Unknown prepared statement handler (stmt) given to DEALLOCATE PREPARE
ERROR 1193 (HY000) at line 92: Unknown system variable 'have_csv'
ERROR 1064 (42000) at line 94: 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 'NULL' at line 1
ERROR 1243 (HY000) at line 95: Unknown prepared statement handler (stmt) given to EXECUTE
ERROR 1243 (HY000) at line 96: Unknown prepared statement handler (stmt) given to DEALLOCATE PREPARE
大致問題:一個未知的變數 在檢視,沒有明白

檢視master.err 錯誤日誌

2018-11-16 19:07:21 86997 [ERROR] Column count of performance_schema.events_waits_current is wrong. Expected 19, found 16. The table is probably corrupted
2018-11-16 19:07:21 86997 [ERROR] Column count of performance_schema.events_waits_history is wrong. Expected 19, found 16. The table is probably corrupted
2018-11-16 19:07:21 86997 [ERROR] Column count of performance_schema.events_waits_history_long is wrong. Expected 19, found 16. The table is probably corrupted
在檢視使用mysql --version 輸出為

mysql  Ver 14.14 Distrib 5.5.11, for Linux (x86_64) using  EditLine wrapper

在資料庫裡面檢視 mysql version()

+------------+
| version()  |
+------------+
| 5.6.42-log |
+------------+
感覺有點奇怪呀,為什麼出現這樣的現象,輸出不一致

首先檢視 .bash_profile 檢視沒有 奇怪了 

使用 which mysql 

/application/mysql/bin/mysql

在一看 這個目錄下對mysql 做了個軟連線 指向的是5.5 的MySQL包下面對bin,突然明白了,為什麼出現這個問題 

直接在.bash_profile 中新增變數  

source .bash_profile  

使用命令 mysql --version 

mysql  Ver 14.14 Distrib 5.6.42, for linux-glibc2.12 (x86_64) using  EditLine wrapper

這下對了 ,在使用

[email protected] ~]# mysql_upgrade -uroot -pzgs 
Warning: Using a password on the command line interface can be insecure.
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock' 
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock' 
Warning: Using a password on the command line interface can be insecure.
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.servers                                      OK
mysql.slow_log                                     OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
Running 'mysql_fix_privilege_tables'...
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock' 
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock' 
Warning: Using a password on the command line interface can be insecure.
test.ii                                            OK
test.level                                         OK
test.mm                                            OK
test.nn                                            OK
test.pp                                            OK
test.qq                                            OK
test.sc                                            OK
test.test                                          OK
test.uu                                            OK
test.yy                                            OK
test.zz                                            OK
OK
升級成功 。

這下明白了 

在說一個小坑 ,在後來檢視mysql 的path寫在了 /etc/profile 

導致我第一時間檢視.bash_profile 沒有檢視到問題的原因

同時百度了一下 它們倆的執行順序

/etc/profile ->/etc/enviroment -->HOME/.profile−−>HOME/.profile−−>HOME/.env

所以再寫path 的時候 還是下載使用者的環境變數吧

心裡苦呀 想了差不多兩天!