Problem installing mariadb/mysql : unknown option '--initialize'

after installing mariadb, when I tried to initialize the configuration and get the generated password by

mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql

it got

mysqld: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadbd' instead
2024-04-13 15:42:22 0 [Note] Starting MariaDB 11.3.2-MariaDB source revision 068a6819eb63bcb01fdfa037c9bf3bf63c33ee42 as process 6235
2024-04-13 15:42:22 0 [Note] InnoDB: Compressed tables use zlib 1.3.1
2024-04-13 15:42:22 0 [Note] InnoDB: Number of transaction pools: 1
2024-04-13 15:42:22 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2024-04-13 15:42:22 0 [Note] InnoDB: Using liburing
2024-04-13 15:42:22 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
2024-04-13 15:42:22 0 [Note] InnoDB: Completed initialization of buffer pool
2024-04-13 15:42:22 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
2024-04-13 15:42:22 0 [Note] InnoDB: End of log at LSN=47763
2024-04-13 15:42:22 0 [Note] InnoDB: Opened 3 undo tablespaces
2024-04-13 15:42:22 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active.
2024-04-13 15:42:22 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2024-04-13 15:42:22 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2024-04-13 15:42:22 0 [Note] InnoDB: log sequence number 47763; transaction id 14
2024-04-13 15:42:22 0 [Note] Plugin 'wsrep-provider' is disabled.
2024-04-13 15:42:22 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2024-04-13 15:42:22 0 [ERROR] mysqld: unknown option '--initialize'
2024-04-13 15:42:22 0 [ERROR] Aborting

One could or should probably ask where you got that command from …
As the message says -

the option is unknown - it is not valid syntax
the manual page doesn’t list it either

Hi @Esolia, and welcome!

Question is, how did you install it? It’s in the extra repository:

$ pamac search mariadb
[...]
mariadb  11.3.2-1 [Installed]                                              extra
    Fast SQL database server, derived from MySQL

So it could be installed with:

pamac install mariadb

Followed by following these directions:

https://wiki.archlinux.org/title/MariaDB#Installation

Hope this helps!

at the beginning, i installed mariadb based on a blog

pacman -S mysql

and it told me to choose from “mariadb” “mariadbLTS” and another one(i forgot it). I chose “mariadb”. After completed, I ran the folloing command

mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

returned

Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
OK

and then when i ran the command in the post, the the “unkonw option --initialize” problem occured

it’s an unknown option - that switch simply doesn’t exist
(maybe it did in the past, but not anymore - I don’t know)
the program doesn’t know what to do with it …

The conclusion would be:
that post contains inaccurate information. :man_shrugging:

This source here should be reliable:

MariaDB - ArchWiki

1 Like

ill have a try, thks

Note that relying on random articles regarding this is highly discourages. I mean this:

pacman -S mysql

…will not install MariaDB. In fact, I couldn’t even find a package by that name in the repositories. So that command probably didn’t install anything.

Instead, see the Manjaro Wiki:

…or the Arch Wiki:

https://wiki.archlinux.org/

…for things like this.

Indeed no such package exists…it’s not a metapackage or a group…yet it did what the OP said it did.

$ sudo pacman -S mysql
:: There are 3 providers available for mysql:
:: Repository extra
   1) mariadb  2) mariadb-lts  3) percona-server

The reason seems to be in the man page.

Packages that provide other packages are also handled. For example, pacman -S foo will first look for a foo package. If foo is not found, packages that provide the same functionality as foo will be searched for. If any package is found, it will be
installed. A selection prompt is provided if multiple packages providing foo are found.


@ whoever may be interested

pacman's man page seems to be incomplete regarding searching

A regex search brings up the same options.

# ^ is the start of a line or string
# $ is the end of a line or string
# both the name and description are searched
# but none should match
# unless the description is tokenised
$ pacman -Ss ^mysql$
extra/mariadb 11.3.2-1
    Fast SQL database server, derived from MySQL
extra/mariadb-lts 11.2.3-1
    Fast SQL database server, derived from MySQL (LTS)
extra/percona-server 8.1.0_1-3
    Drop-in replacement for MySQL that provides improved performance, diagnostics, instrumentation and MyRocks storage engine

# it's case insensitive
# but the description is not tokenised
$ pacman -Ss Mozilla.org$
extra/firefox 124.0.1-1 [installed]
    Standalone web browser from mozilla.org
extra/thunderbird 115.9.0-1 [installed]
    Standalone mail and news reader from mozilla.org

$ pacman -Ss ^Mozilla.org$

# the only mention of mariadb for percona
# is in the provides field
$ pacman -Ss ^mariadb$
extra/mariadb 11.3.2-1 [installed]
    Fast SQL database server, derived from MySQL
extra/mariadb-lts 11.2.3-1
    Fast SQL database server, derived from MySQL (LTS)
extra/percona-server 8.1.0_1-3
    Drop-in replacement for MySQL that provides improved performance, diagnostics, instrumentation and MyRocks storage engin

The man page only says the package name and description are searched, however the above seems to suggest that the provides field is also searched. Unless something else is going on.

-s, --search
This will search each package in the sync databases for names or descriptions that match regexp. When you include multiple search terms, only packages with descriptions matching ALL of those terms will be returned.

EDIT:

Thank you for the solution…but I’m not sure how my post solved your issue…

Everyone else provided a solution, I think @Nachlese’s 2nd post has the best explanation and a good link (everyone gave goods links though).

1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.