/usr/bin/mysqld: unknown variable 'default-character-set=utf8'的解决

本文介绍了使用rpm包安装MySQL-server-5.5.11过程中遇到的字符集配置问题及解决方案。当尝试通过在my.cnf文件中设置default-character-set=utf8来更改默认字符集时,MySQL服务启动失败,并在日志文件中报告未知变量错误。通过将default-character-set=utf8更改为character_set_server=utf8解决了该问题。

通过rpm包的方式安装了MySQL-server-5.5.11,直接在命令行输入service mysql start,启动mysql成功,

然后修改/etc/my.cnf,给[mysqld]下增加了default-character-set=utf8,再重启mysql服务,这时候报错:

Starting MySQL............The server quit without updating PID file (/var/lib/mysql/node1.pid). [faild]

查看日志/var/log/mysql.log,发现其中提示:

/usr/bin/mysqld: unknown variable 'default-character-set=utf8'

看来是 default-character-set=utf8这个设置项惹得祸....

在网上搜索一番,发现有人提出,用character_set_server=utf8来取代 default-character-set=utf8 能解决这个问题,

试了试,换掉 character_set_server=utf8, 再启动果然没问题了...

[root@sibas-dev-02 bin]# ./mysqld --initialize --console --lower-case-table-names=1 2025-08-26T09:33:13.408332Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release. 2025-08-26T09:33:13.408845Z 0 [System] [MY-013169] [Server] /usr/local/mysql8.0/mysql-8.0.26/bin/mysqld (mysqld 8.0.26) initializing of server in progress as process 3396 2025-08-26T09:33:13.409017Z 0 [ERROR] [MY-010338] [Server] Can't find error-message file '/usr/local/mysql-8.0.26/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive. 2025-08-26T09:33:13.410865Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. 2025-08-26T09:33:13.447278Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2025-08-26T09:33:14.405355Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2025-08-26T09:33:16.488054Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main 2025-08-26T09:33:16.489925Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main 2025-08-26T09:33:16.832542Z 0 [ERROR] [MY-000067] [Server] unknown variable 'default-character-set=utf8'. 2025-08-26T09:33:16.834199Z 0 [ERROR] [MY-013455] [Server] The newly created data directory /var/lib/mysql/ by --initialize is unusable. You can remove it. 2025-08-26T09:33:16.836498Z 0 [ERROR] [MY-010119] [Server] Aborting 2025-08-26T09:33:18.602771Z 0 [System] [MY-010910] [Server] /usr/local/mysql8.0/mysql-8.0.26/bin/mysqld: Shutdown complete (mysqld 8.0.26) MySQL Community Server - GPL.
最新发布
08-27
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值