簡體   English   中英

無法在 Ubuntu 16.04 上為 mysql-5.7 使用 MySQL my.cnf 文件

[英]Cannot use MySQL my.cnf file on Ubuntu 16.04 for mysql-5.7

我已經在 Ubuntu 16.04 服務器上安裝了 percona-xtradb-cluster-server-5.7,並且 mysql 在我們的默認配置下運行良好。 但是,當我嘗試編輯 my.cnf 文件時,我收到變量未知的錯誤,例如:

mysql: [ERROR] unknown variable 'datadir=/var/mysql/mysql'

我試圖在服務器上找到不同的 my.cnf 文件,並嘗試一個接一個地添加變量,但似乎遇到了相同的錯誤。

所以我的問題是,適用於 Ubuntu 16.04 上的 MySQL 5.7 的 my.cnf 文件在哪里? 我什至嘗試過:/etc/mysql/conf.d/mysql.cnf localtion 並收到以下錯誤:

[....] Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
 failed!

以下是與我的 Ubuntu 16.04 服務器上可能的 MySQL 5.7 配置文件相關的信息

ubuntu@db-test-1:~$ sudo find / -name my.cnf
/etc/mysql/my.cnf
/etc/alternatives/my.cnf
/var/lib/dpkg/alternatives/my.cnf
ubuntu@db-test-1:~$
ubuntu@db-test-1:~$ sudo ls -l /etc/mysql/
total 20
drwxr-xr-x 2 root root 4096 Oct 30 15:05 conf.d
-rw-r--r-- 1 root root  237 Oct 30 12:42 debian.cnf
-rw-r--r-- 1 root root  836 Oct 30 14:49 my.cnf
-rw-r--r-- 1 root root  380 Oct 24 01:18 percona-xtradb-cluster.cnf
drwxr-xr-x 2 root root 4096 Oct 30 11:51 percona-xtradb-cluster.conf.d
ubuntu@db-test-1:~$ sudo ls -l /etc/mysql/conf.d/
total 8
-rw-r--r-- 1 root root  8 Oct 30 15:05 mysql.cnf
-rw-r--r-- 1 root root 55 Jan 22  2017 mysqldump.cnf
ubuntu@db-test-1:~$ /usr/sbin/mysqld --verbose --help | grep -A 1 "Default options"^C
ubuntu@db-test-1:~$ sudo su
root@db-test-1:/home/ubuntu# /usr/sbin/mysqld --verbose --help | grep -A 1 "Default options"
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf

順便說一下,debian.cnf 文件沒有 5.7 版,但我添加了它,因為我需要它在刷新日志期間進行日志輪換。

下面是我在 /etc/mysql/conf.d/mysql.cnf 配置文件底部添加的 galera 配置:

server-id = 1010101
# Galera Config
wsrep_cluster_address = gcomm://10.1.0.101, 10.1.0.101
wsrep_cluster_name = db-hr
wsrep_provider = /usr/lib/libgalera_smm.so    
wsrep_provider_options = "gcache.size=4G"
wsrep_slave_threads = 4
wsrep_sst_auth = "user:secret"
wsrep_sst_method = xtrabackup-v2

my.cnf 文件是分節設置的,這個參數應該設置在 [mysqld] 節下。 該錯誤表明您可能在 [mysql] 或 [client] 部分擁有它。 有一個免費的在線工具可以幫助您正確創建 my.cnf,但您必須注冊您的電子郵件才能訪問它: https : //tools.percona.com/

有一個 Ubuntu 的分步示例可以幫助您完成這里https://www.percona.com/doc/percona-xtradb-cluster/LATEST/howtos/ubuntu_howto.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM