我有一个简单的问题,关于通过命令访问 mysql。当我尝试以 root 身份访问它时,它返回一条消息:
mysql: unknown option '--innodb_file_per_table'
如何才能让它恢复工作?
谢谢 Rick。我已成功获得访问权限,服务器正在运行,我担心的是启动/停止/重启期间出现大量错误
错误日志
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;
。从今以后(直到您注销),_此连接的表CREATEs
将为每个表单独设置。此外,由于该设置是“全局”的,它将适用于其他登录的用户后做SET
和前然后下次重新启动(或者关闭标志)。
计划 D:(仅在 MySQL 8.0 中)Root 可以使用选项执行此SET
操作PERSIST
。(但我不会详细介绍。)
警告:不同的设置有不同的规则。这 4 个计划适用于一些设置。更少或更多的计划适用于其他设置。一个线索是文档说明了设置是“全局”还是“会话”或两者兼而有之。