gpt4 book ai didi

MySQL my.cnf 文件 - 找到没有前面组的选项

转载 作者:行者123 更新时间:2023-11-29 16:06:56 25 4
gpt4 key购买 nike

我正在尝试远程连接到 Ubuntu 中的数据库,但在尝试 mysql -u root -p 时收到错误消息:

Found option without preceding group in config file: /etc/mysql/my.cnf at line: 1

my.cnf 看起来像:

[mysqld]
user = mysql
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
bind-address = 0.0.0.0
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover = BACKUP
query_cache_limit = 1M
query_cache_size = 16M
log_error = /var/log/mysql/error.log
expire_logs_days = 10
max_binlog_size = 100M

[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock

[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqldump]
quick
quote-names
max_allowed_packet = 16M

[mysql]

[isamchk]
key_buffer = 16M

最佳答案

缺少配置 header

只需在 /etc/mysql/my.cnf 文件中添加 [mysqld] 作为第一行即可。

示例

[mysqld]
default-time-zone = "+08:00"

之后,记得重新启动 MySQL 服务。

sudo mysqld stop
sudo mysqld start

关于MySQL my.cnf 文件 - 找到没有前面组的选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55654179/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com