欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

mysql提示[Warning] Invalid (old?) table or database name問題的解決方法

 更新時(shí)間:2012年07月29日 10:54:02   作者:  
今天一個(gè)朋友的上服務(wù)器出現(xiàn)[Warning] Invalid (old?) table or database name問題,通過分析binlog日志發(fā)現(xiàn),在以下sql語句中出現(xiàn)問題,由于涉及敏感內(nèi)容,用sql語法表示
DROP TABLE IF EXISTS [TEMP_TABLE_NAME];
create temporary table [TEMP_TABLE_NAME] select col1,col2,... from [TABLE_NAME];
alter table [TEMP_TABLE_NAME] add unique idx_col1(col1);
經(jīng)過以上操作中,多次出現(xiàn)該warning問題。通過查詢和跟蹤調(diào)試源碼,有以下線索和處理方式:
mysql的"[Warning] Invalid (old?) table or database name"問題出現(xiàn)位置:

sql_table.cc:279
uint explain_filename (THD* thd, const char *from, char *to , uint to_length , enum_explain_filename_mode explain_mode )

跟蹤代碼發(fā)現(xiàn),只有在ha_innodb.cc:1946的innobase_convert_identifier 中調(diào)用explain_filename函數(shù)。
復(fù)制代碼 代碼如下:

/*****************************************************************//**
Convert an SQL identifier to the MySQL system_charset_info (UTF-8)
and quote it if needed.
@return pointer to the end of buf */
static char* innobase_convert_identifier (
/*========================*/
char* buf, /*!< out: buffer for converted identifier */
ulint buflen, /*!< in: length of buf, in bytes */
const char * id, /*!< in: identifier to convert */
ulint idlen, /*!< in: length of id, in bytes */
void* thd, /*!< in: MySQL connection thread, or NULL */
ibool file_id) /*!< in: TRUE=id is a table or database name;
FALSE=id is an UTF-8 string */

順著線索向上查找,發(fā)現(xiàn)在有兩個(gè)位置調(diào)用了innobase_convert_identifier 函數(shù),分兩個(gè)線索繼續(xù)查找。

線索一:
ha_innodb.cc:2034
調(diào)用innodb_convert_identifier函數(shù)
復(fù)制代碼 代碼如下:

/*****************************************************************//**
Convert a table or index name to the MySQL system_charset_info (UTF-8)
and quote it if needed.
@return pointer to the end of buf */
extern "C" UNIV_INTERN char* innobase_convert_name (
/*==================*/
char* buf, /*!< out: buffer for converted identifier */
ulint buflen, /*!< in: length of buf, in bytes */
const char * id, /*!< in: identifier to convert */
ulint idlen, /*!< in: length of id, in bytes */
void* thd, /*!< in: MySQL connection thread, or NULL */
ibool table_id) /*!< in: TRUE=id is a table or database name;
FALSE=id is an index name */

從函數(shù)定義和函數(shù)功能來看,該函數(shù)是將mysql的表名或者索引名轉(zhuǎn)換成utf8,與字符集相關(guān)。查看現(xiàn)有數(shù)據(jù)庫字符集和生成的臨時(shí)表字符集均為lanti1,推斷是可能的原因之一。
處理方式:
修改數(shù)據(jù)庫的字符集為utf8,觀察數(shù)據(jù)庫是否仍然出現(xiàn)該錯(cuò)誤。

線索二:
復(fù)制代碼 代碼如下:

ha_innodb.cc:6269
調(diào)用innodb_convert_identifier函數(shù)
/*****************************************************************//**
Creates a table definition to an InnoDB database. */
static create_table_def (
/*=============*/
trx_t* trx, /*!< in: InnoDB transaction handle */
TABLE* form, /*!< in: information on table
columns and indexes */
const char * table_name, /*!< in: table name */
const char * path_of_temp_table, /*!< in: if this is a table explicitly
created by the user with the
TEMPORARY keyword, then this
parameter is the dir path where the
table should be placed if we create
an .ibd file for it (no .ibd extension
in the path, though); otherwise this
is NULL */
ulint flags) /*!< in: table flags */

在create_table_def 函數(shù)中,調(diào)用row_create_table_for_mysql函數(shù)后,當(dāng)返回值為DB_DUPLICATE_KEY時(shí),調(diào)用innodb_convert_identifier,從而觸發(fā)該warning。
復(fù)制代碼 代碼如下:

row0mysql.c:1820
UNIV_INTERN int row_create_table_for_mysql(
/*=======================*/
dict_table_t* table, /*!< in, own: table definition
(will be freed) */
trx_t* trx) /*!< in: transaction handle */

該函數(shù)中調(diào)用了更深層次的函數(shù),但從調(diào)試代碼來看,暫時(shí)沒有發(fā)現(xiàn)導(dǎo)致該問題的點(diǎn)。
處理方式:
在線索一中的處理方式不能解決問題的情況下,再進(jìn)行進(jìn)一步的代碼分析。
總結(jié):
經(jīng)過以上代碼調(diào)試和分析,得出兩條線索,但是一直未能重現(xiàn)該問題。因此,目前只能對(duì)現(xiàn)有服務(wù)器進(jìn)行線索一的處理。如果按照線索一處理方式處理后,仍然出現(xiàn)該問題,將對(duì)第二步進(jìn)行深入的分析。

作者 king_wangheng

相關(guān)文章

  • mysql中的存儲(chǔ)過程傳參問題

    mysql中的存儲(chǔ)過程傳參問題

    這篇文章主要介紹了mysql中的存儲(chǔ)過程傳參問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-10-10
  • MySQL?移動(dòng)數(shù)據(jù)目錄后啟動(dòng)失敗問題解決

    MySQL?移動(dòng)數(shù)據(jù)目錄后啟動(dòng)失敗問題解決

    由于安裝數(shù)據(jù)庫時(shí)將MySQL的數(shù)據(jù)目錄放在了根目錄下,現(xiàn)在存儲(chǔ)空間不足,遇到這個(gè)問題如何解決呢,下面小編給大家?guī)砹薽ysql移動(dòng)數(shù)據(jù)目錄啟動(dòng)失敗解決方法,感興趣的朋友一起看看吧
    2023-04-04
  • Centos7.3下mysql5.7.18安裝并修改初始密碼的方法

    Centos7.3下mysql5.7.18安裝并修改初始密碼的方法

    這篇文章主要為大家詳細(xì)介紹了Centos7.3下mysql5.7.18安裝并修改初始密碼的方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-06-06
  • Mysql通過ibd文件恢復(fù)數(shù)據(jù)的詳細(xì)步驟

    Mysql通過ibd文件恢復(fù)數(shù)據(jù)的詳細(xì)步驟

    mysql在使用的過程中,難免遇到數(shù)據(jù)庫表誤操作,下面這篇文章主要給大家介紹了關(guān)于Mysql通過ibd文件恢復(fù)數(shù)據(jù)的詳細(xì)步驟,文中通過實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-06-06
  • mysql去重查詢的三種方法小結(jié)

    mysql去重查詢的三種方法小結(jié)

    本文主要介紹了mysql去重查詢的三種方法小結(jié),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-03-03
  • sql 流水號(hào)獲取代碼實(shí)例

    sql 流水號(hào)獲取代碼實(shí)例

    這篇文章主要介紹了sql 流水號(hào)獲取代碼實(shí)例,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-09-09
  • 淺談為什么MySQL不建議delete刪除數(shù)據(jù)

    淺談為什么MySQL不建議delete刪除數(shù)據(jù)

    這篇文章主要介紹了淺談為什么MySQL不建議delete刪除數(shù)據(jù),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-01-01
  • MySQL刪除數(shù)據(jù),表文件大小依然沒變的原因

    MySQL刪除數(shù)據(jù),表文件大小依然沒變的原因

    這篇文章主要介紹了MySQL刪除數(shù)據(jù),表文件大小依然沒變的原因,幫助大家更好的理解MySQL中的數(shù)據(jù)表,感興趣的朋友可以了解下
    2020-10-10
  • MySQL教程DML數(shù)據(jù)操縱語言示例詳解

    MySQL教程DML數(shù)據(jù)操縱語言示例詳解

    這篇文章主要為大家介紹了MySQL教程中DML數(shù)據(jù)操縱語言的示例詳解,要想學(xué)好MySQL最重要的是要先學(xué)好數(shù)據(jù)操縱語言DML,本文對(duì)其進(jìn)行了全面的講解
    2021-10-10
  • MacBook下python3.7安裝教程

    MacBook下python3.7安裝教程

    這篇文章主要為大家詳細(xì)介紹了MacBook下python3.7安裝教程,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-07-07

最新評(píng)論