mysql --innodb_file_per_table

mysql --innodb_file_per_table

我有一個關於透過命令存取 mysql 的簡單問題。當我嘗試以 root 身分存取它時,它會傳回一條訊息:

mysql: unknown option '--innodb_file_per_table'

如何讓它恢復工作?


謝謝瑞克。我已經管理了訪問權限,伺服器正在工作,令我擔心的是啟動/停止/重新啟動期間出現一堆錯誤

錯誤日誌

2020-12-17 19:16:40 0 [Note] InnoDB: Using Linux native AIO
2020-12-17 19:16:40 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-12-17 19:16:40 0 [Note] InnoDB: Uses event mutexes
2020-12-17 19:16:40 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-12-17 19:16:40 0 [Note] InnoDB: Number of pools: 1
2020-12-17 19:16:40 0 [Note] InnoDB: Using SSE2 crc32 instructions
2020-12-17 19:16:40 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-12-17 19:16:40 0 [Note] InnoDB: Completed initialization of buffer pool
2020-12-17 19:16:40 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority       ().
2020-12-17 19:16:40 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2020-12-17 19:16:40 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-12-17 19:16:40 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-12-17 19:16:40 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-12-17 19:16:40 0 [Note] InnoDB: 10.3.27 started; log sequence number 8459955162; transaction id 23688770
2020-12-17 19:16:40 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-12-17 19:16:40 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-12-17 19:16:40 0 [Note] Server socket created on IP: '127.0.0.1'.
2020-12-17 19:16:40 0 [Note] Reading of all Master_info entries succeeded
2020-12-17 19:16:40 0 [Note] Added new Master_info '' to hash table
2020-12-17 19:16:40 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.3.27-MariaDB-0+deb10u1'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Debian 10
2020-12-17 19:16:40 0 [Note] InnoDB: Buffer pool(s) load completed at 201217 19:16:40

答案1

計劃A(混亂且不建議):將該選項新增至mysqld(伺服器程序,而不是mysql客戶端程式)。

計畫 B:更改設定my.cnf(或設定檔所在的位置)。然後重新啟動伺服器。 (重新啟動取決於作業系統。)

計畫 C:以 mysql 的「root」使用者身分登錄,執行SET GLOBAL innodb_file_per_table = 1;.從今往後(直到您登出),表 _this 連接CREATEs將是每個表一個檔案。此外,由於該設定是「全域」的,因此它將應用於登入的其他人SET然後下次重新啟動(或關閉該標誌)。

計劃 D:(僅限 MySQL 8.0)Root 可以SET透過選項執行此PERSIST操作。 (但我不會詳細介紹。)

注意:不同的設定有不同的規則。這 4 個計劃適用於一些設定.更少或更多計劃適用於其他設定。一條線索是文件說明該設定是「全域」還是「會話」或兩者兼而有之。

相關內容