0

I am modifying /etc/mysql/mariadb.conf.d/50-server.cnf

When I add the following code, i get the error unknown variable 'pid-file=/run/mysqld/mysqld.pid'

[mysql]
default-character-set = utf8mb4

I am adding the mysql tag as well as it is not in the file, but I don't understand why this line is effecting the pid variable which seems to be defined in the mysql conf file.

Any ideas?

full contents of 50-server.cnf

[server]

[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql] 
default-character-set = utf8mb4

# * Basic Settings
#
user                    = mysql
pid-file                = /run/mysqld/mysqld.pid
socket                  = /run/mysqld/mysqld.sock
#port                   = 3306
basedir                 = /usr
datadir                 = /var/lib/mysql
tmpdir                  = /tmp
lc-messages-dir         = /usr/share/mysql
#skip-external-locking

bind-address            = 127.0.0.1
query_cache_size        = 16M

log_error = /var/log/mysql/error.log
expire_logs_days        = 10
character-set-server  = utf8mb4
collation-server      = utf8mb4_general_ci

[embedded]

[mariadb]

[mariadb-10.3]
4
  • 1
    Can you annotate in your config where you tried putting those config lines? Aug 31, 2020 at 5:06
  • Yes sure, I've added them in there. I wonder should mysql have a heading in there as well before modifying the file?
    – David
    Aug 31, 2020 at 9:07
  • 1
    You canøt just add it in the miffle of another block ([mysqld]). It has to go before or after existing nlocks, that is just before {mysqld] or just before [embedded].
    – Soren A
    Aug 31, 2020 at 9:09
  • Thanks Soren, that explains it, I hadn't noticed the lack of a heading below! I'll try later.
    – David
    Aug 31, 2020 at 10:24

1 Answer 1

1

To formally put this as an answer, the square brackets denote sections of the config and you cut the [mysqld] section in half with your inserted [mysql] section. This has the affect of putting the pid-file setting under [mysql] rather than [mysqld]. Judging my the error, [mysql] does not have a a pid-file setting.

Either add your [mysql] settings at the top or bottom of the file and you should be set. Alternatively, put them into a sibling file 50-server.cnf called 51-client.cnf so you can easily find them in the future (the number in the file name is load order and the name is arbitrary).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .