mysql: [ERROR] unknown option ‘--// 设置默认时区‘

本文指导如何修复mysql配置中关于'–//设置默认时区'的未知选项错误,涉及修改my.ini文件编码并添加default-time-zone属性。务必在[mysqld]下配置,重启mysql以生效。
  • cmd报错误:mysql [ERROR] unknown option ‘–// 璁剧疆榛樿 鏃跺尯’.

my.ini文件编码类型错误,先修改编码类型,看看具体是哪里的错误。
打开my.ini文件,点击另存为,将编码设置为ANSI保存
在这里插入图片描述
重新输入发现

  • cmd报错误:mysql: [ERROR] unknown option '–// 设置默认时区’

解决方案:
在 [mysqld] 之下加
default-time-zone=timezone
来修改时区。如:
default-time-zone = ‘+8:00’
修改完了记得记得重启msyql
注意一定要在 [mysqld] 之下加 ,否则会出现 unknown variable 'default-time-zone=+8:00’

17:19:18 INTROSPECTION INIT: Product: IntelliJ IDEA 2024.1 Project: huacai-blog DBMS: MySQL Accessibility matcher: none Connection bounds: null 17:19:18 Given model is accepted 17:19:18 Introspection scope is specified explicitly, but it is the same as the data source's one: Pattern: kind: schema name: `@`, `blog` 17:19:18 Introspector version: 0 17:19:18 Executing query: -- 8< -- select database() -- >8 -- 17:19:18 execution time: 2 ms fetching time: 3 ms 17:19:18 Attached to database DBMS: MySQL Server version: 5.7.21 Driver version: 8.2 17:19:18 Memory: 859 M available from allocated 1640 M (max 4048 M) 17:19:18 Executing query: -- 8< -- select @@event_scheduler -- >8 -- 17:19:18 execution time: 2 ms fetching time: 3 ms 17:19:18 Connection-related state is initialized. The parameters map: empty map 17:19:18 Detaching from DB 17:19:18 Memory: 856 M available from allocated 1640 M (max 4048 M) 17:19:18 Query Performance Statistics: -------------------------------------------------------------------------------------------------------------------------------------------- ## count err T.min T.avg T.max T.sum % rows packs Query -------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------- Total duration of all queries: 0.000 s. 17:19:18 Dropping the info 17:19:18 Attached to database DBMS: MySQL Server version: 5.7.21 Driver version: 8.2 17:19:18 Memory: 856 M available from allocated 1640 M (max 4048 M) 17:19:18 Executing query: -- 8< -- select @@event_scheduler -- >8 -- 17:19:18 execution time: 1 ms fetching time: 2 ms 17:19:18 Connection-related state is initialized. The parameters map: empty map 17:19:18 ==================================================== REQUEST WITH 1 INTROSPECTION TASKS ==================================================== 17:19:18 Requested tasks: Introspect schema blog in the database 17:19:18 =============================================== DOING A TASK [1/1]: SchemasIntrospectionTask =============================================== 17:19:18 Task description: Introspect schema blog in the database 17:19:18 Retrieving server info 17:19:18 Executing query: -- 8< -- select @@default_storage_engine, @@default_tmp_storage_engine -- >8 -- 17:19:18 execution time: 2 ms fetching time: 1 ms 17:19:18 Executing query: -- 8< -- select table_name from information_schema.tables where lower(table_schema) = 'information_schema' and lower(table_name) = 'parameters' -- >8 -- 17:19:18 execution time: 6 ms fetching time: 1 ms 17:19:18 Retrieving session info 17:19:18 ---------------------------------------------------------- SCHEMA RETRIEVER: blog ---------------------------------------------------------- 17:19:18 Schema has children: true Incremental is possible: false Asked mode: null Decided mode: FULL 17:19:18 Configuration info: - schema id: no - schema has children: yes - mode: FULL - with sources: yes 17:19:18 Families before introspection: - table: 48 17:19:18 Retrieving tables and views 17:19:18 Executing query: -- 8< -- select table_name, table_type, table_comment, engine, table_collation, create_options from information_schema.tables where table_schema = ? -- >8 -- 17:19:18 execution time: 3 ms fetching time: 3 ms 17:19:18 Retrieving columns 17:19:18 Executing query: -- 8< -- select ordinal_position, column_name, column_type, column_default, generation_expression, table_name, column_comment, is_nullable, extra, collation_name from information_schema.columns where table_schema = ? order by table_name, ordinal_position -- >8 -- 17:19:18 execution time: 8 ms fetching time: 5 ms 17:19:18 Executing query: -- 8< -- select table_name, auto_increment from information_schema.tables where table_schema = ? and auto_increment is not null -- >8 -- 17:19:18 execution time: 106 ms fetching time: 4 ms 17:19:18 Retrieving indices 17:19:18 Executing query: -- 8< -- select table_name, index_name, index_comment, index_type, non_unique, column_name, sub_part, collation, null expression from information_schema.statistics where table_schema = ? and index_schema = ? order by index_schema, table_name, index_name, index_type, seq_in_index -- >8 -- 17:19:18 execution time: 2 ms fetching time: 4 ms 17:19:18 Retrieving constraints 17:19:18 Executing query: -- 8< -- select c.constraint_name, c.constraint_schema, c.table_name, c.constraint_type, false enforced from information_schema.table_constraints c where c.table_schema = ? -- >8 -- 17:19:18 execution time: 2 ms fetching time: 3 ms 17:19:18 Executing query: -- 8< -- select r.constraint_name, null table_name, r.match_option, r.update_rule, r.delete_rule from information_schema.referential_constraints r where r.constraint_schema = ? -- >8 -- 17:19:18 execution time: 2 ms fetching time: 1 ms 17:19:18 Retrieving constraint columns 17:19:18 Executing query: -- 8< -- select constraint_name, table_name, column_name, referenced_table_schema, referenced_table_name, referenced_column_name from information_schema.key_column_usage where table_schema = ? and referenced_column_name is not null order by table_name , constraint_name , ordinal_position -- >8 -- 17:19:18 execution time: 3 ms fetching time: 3 ms 17:19:18 Retrieving partitions 17:19:18 Executing query: -- 8< -- select table_name, partition_name, subpartition_name, partition_ordinal_position, subpartition_ordinal_position, partition_method, subpartition_method, partition_expression, subpartition_expression, partition_description, partition_comment/*, tablespace_name*/ from information_schema.partitions where partition_name is not null and table_schema = ? -- >8 -- 17:19:18 execution time: 98 ms fetching time: 1 ms 17:19:18 Retrieving triggers 17:19:18 Executing query: -- 8< -- select trigger_name, event_object_table, event_manipulation, action_timing, definer from information_schema.triggers where trigger_schema = ? -- >8 -- 17:19:18 execution time: 9 ms fetching time: 2 ms 17:19:18 Retrieving scheduled events 17:19:18 Retrieving routines 17:19:18 Executing query: -- 8< -- select routine_name, routine_type, routine_definition, routine_comment, dtd_identifier, definer, is_deterministic = 'YES' is_deterministic, cast(sql_data_access as char(1)) sql_data_access, cast(security_type as char(1)) security_type from information_schema.routines where routine_schema = ? -- >8 -- 17:19:18 execution time: 4 ms fetching time: 1 ms 17:19:18 Retrieving routine permissions 17:19:18 Executing query: -- 8< -- select Host, User, Routine_name, Proc_priv, Routine_type = 'PROCEDURE' as is_proc from mysql.procs_priv where Db = ?; -- >8 -- 17:19:18 execution time: 1 ms fetching time: 2 ms 17:19:18 Retrieving column permissions 17:19:18 Executing query: -- 8< -- select grantee, table_name, column_name, privilege_type, is_grantable from information_schema.column_privileges where table_schema = ? union all select grantee, table_name, '' column_name, privilege_type, is_grantable from information_schema.table_privileges where table_schema = ? order by table_name, grantee, privilege_type -- >8 -- 17:19:18 execution time: 1 ms fetching time: 1 ms 17:19:18 Retrieving arguments 17:19:18 Executing query: -- 8< -- select specific_name, ordinal_position, parameter_name, parameter_mode, dtd_identifier from information_schema.parameters where specific_schema = ? and ordinal_position > 0 order by specific_name, ordinal_position -- >8 -- 17:19:18 execution time: 2 ms fetching time: 1 ms 17:19:18 Retrieving view sources 17:19:18 Executing query: -- 8< -- select table_name, view_definition, definer from information_schema.views where table_schema = ? -- >8 -- 17:19:18 execution time: 3 ms fetching time: 2 ms 17:19:18 Retrieving routine sources 17:19:18 Retrieving routine sources (circumventing MySQL bugs) 17:19:18 Retrieving trigger sources 17:19:18 Retrieving trigger sources (circumventing MySQL bugs) 17:19:18 Retrieving event sources 17:19:18 Retrieving event sources (circumventing MySQL bugs) 17:19:18 Status details: Finishing retrieving the schema blog 17:19:18 No deferred tasks to process. 17:19:18 Detaching from DB 17:19:18 Memory: 844 M available from allocated 1640 M (max 4048 M) 17:19:18 Query Performance Statistics: -------------------------------------------------------------------------------------------------------------------------------------------- ## count err T.min T.avg T.max T.sum % rows packs Query -------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------- Total duration of all queries: 0.000 s. 17:19:18 Dropping the info 17:19:18 Metrics: ================================== Operation Cnt Min Avg Max Sum ---------------------------------- ---------------------------------- Total: 0.000
最新发布
09-29
2025-03-06T02:25:46.280842Z 0 [System] [MY-015015] [Server] MySQL Server - start. 2025-03-06T02:25:46.642135Z 0 [Warning] [MY-010097] [Server] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path. 2025-03-06T02:25:46.642229Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 9.2.0) starting as process 1 2025-03-06T02:25:46.653470Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2025-03-06T02:25:48.847791Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2025-03-06T02:25:49.832026Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2025-03-06T02:25:49.832132Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2025-03-06T02:25:49.837389Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. 2025-03-06T02:25:49.845372Z 0 [ERROR] [MY-000068] [Server] unknown option '--skip-character-set-client-handshake'. 2025-03-06T02:25:49.846357Z 0 [ERROR] [MY-010119] [Server] Aborting 2025-03-06T02:25:51.418607Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 9.2.0) MySQL Community Server - GPL. 2025-03-06T02:25:51.418687Z 0 [System] [MY-015016] [Server] MySQL Server - end. 这个是为什么?你看看我得配置文件对不对: [client] default-character-set=utf8mb4 [mysql] default-character-set=utf8mb4 [mysqld] # 设置东八区时区 default-time_zone = '+8:00' # 设置密码验证规则,default_authentication_plugin参数已被废弃 # 改为authentication_policy #default_authentication_plugin=mysql_native_password authentication_policy=mysql_native_password # 限制导入和导出的数据目录 # 为空,不限制导入到处的数据目录; # 指定目录,必须从该目录导入到处,且MySQL不会自动创建该目录; # 为NULL,禁止导入与导出功能 #secure_file_priv=/var/lib/mysql secure_file_priv= init_connect='SET collation_connection = utf8mb4_0900_ai_ci' init_connect='SET NAMES utf8mb4' character-set-server=utf8mb4 collation-server=utf8mb4_0900_ai_ci skip-character-set-client-handshake skip-name-resolve
03-08
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值