You are not logged in.

#1 2018-08-25 13:57:41

saifazmi
Member
From: London, UK
Registered: 2018-08-25
Posts: 4
Website

[SOLVED] mysql_install_db command is missing after installing mysql

I'm trying to get mysql working on my system. I installed the following packages from the AUR:

The arch wiki page on MySQL asks to run the following command:

# mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

The problem is that the mysql_install_db command is not available after installation. And when I try to run the mysqld.service, I get the following error; which I believe is the result of me not running the mysql_install_db mentioned above.

● mysqld.service - MySQL database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
   Active: activating (start-post) (Result: exit-code) since Sat 2018-08-25 14:43:50 BST; 6s ago
  Process: 17701 ExecStart=/usr/bin/mysqld --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
 Main PID: 17701 (code=exited, status=1/FAILURE); Control PID: 17702 (mysqld-post)
    Tasks: 2 (limit: 4915)
   Memory: 2.6M
   CGroup: /system.slice/mysqld.service
           ├─17702 /bin/sh /usr/bin/mysqld-post
           └─18438 sleep 1

Aug 25 14:43:50 archBox systemd[1]: Starting MySQL database server...
Aug 25 14:43:50 archBox mysqld[17701]: 2018-08-25T13:43:50.480932Z 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 1024 (requested 8161)
Aug 25 14:43:50 archBox mysqld[17701]: 2018-08-25T13:43:50.481041Z 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 431 (requested 4000)
Aug 25 14:43:50 archBox mysqld[17701]: 2018-08-25T13:43:50.708217Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
Aug 25 14:43:50 archBox mysqld[17701]: 2018-08-25T13:43:50.708270Z 0 [System] [MY-010116] [Server] /usr/bin/mysqld (mysqld 8.0.12) starting as process 17701
Aug 25 14:43:50 archBox mysqld[17701]: 2018-08-25T13:43:50.738415Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
Aug 25 14:43:50 archBox mysqld[17701]: 2018-08-25T13:43:50.738564Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
Aug 25 14:43:50 archBox mysqld[17701]: 2018-08-25T13:43:50.738579Z 0 [ERROR] [MY-010119] [Server] Aborting
Aug 25 14:43:50 archBox mysqld[17701]: 2018-08-25T13:43:50.738767Z 0 [System] [MY-010910] [Server] /usr/bin/mysqld: Shutdown complete (mysqld 8.0.12)  MySQL Community Server (GPL).
Aug 25 14:43:50 archBox systemd[1]: mysqld.service: Main process exited, code=exited, status=1/FAILURE

Any help for getting mysql running is welcomed. thanks.

Last edited by saifazmi (2018-08-28 10:13:43)

Offline

#2 2018-08-25 14:08:33

loafer
Member
From: the pub
Registered: 2009-04-14
Posts: 1,772

Re: [SOLVED] mysql_install_db command is missing after installing mysql

Are you sure the AUR package installs it?


All men have stood for freedom...
For freedom is the man that will turn the world upside down.
Gerrard Winstanley.

Offline

#3 2018-08-25 14:26:01

loqs
Member
Registered: 2014-03-06
Posts: 17,321

Re: [SOLVED] mysql_install_db command is missing after installing mysql

Offline

#4 2018-08-25 15:06:24

Muflone
Package Maintainer (PM)
From: Italy
Registered: 2013-10-08
Posts: 106
Website

Re: [SOLVED] mysql_install_db command is missing after installing mysql

like loqs pointed, the mysql_install_db command is deprecated in favor of mysqld.
The wiki page should be updated accordingly

Offline

#5 2018-08-25 15:42:30

loqs
Member
Registered: 2014-03-06
Posts: 17,321

Re: [SOLVED] mysql_install_db command is missing after installing mysql

Install mariadb, afterwards run the following command before starting the mariadb.service:

# mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

The wiki page text seems accurate

MariaDB is the default implementation of MySQL in Arch Linux, provided with the mariadb package.
Alternative implementations are:

    Oracle MySQL — An implementation by Oracle Corporation.
    https://www.mysql.com/ || mysqlAUR
    Percona Server — An implementation by Percona LLC.
    http://www.percona.com/software/percona-server/ || percona-server

Possibly it could be made explicitly clear alternative implementations provide differing functionality.

Offline

#6 2018-08-27 08:59:29

saifazmi
Member
From: London, UK
Registered: 2018-08-25
Posts: 4
Website

Re: [SOLVED] mysql_install_db command is missing after installing mysql

Hey everyone, thanks for all info so far. I fixed the issue in the following way:

Since mysql_install_db is deprecated as @loqs pointed out and thanks for the git diff link. I tried to run the following command:

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

But that didn't work as the datadir already existed, so I deleted that directory.

$ sudo rm -rvf /var/lib/mysql

Ran this again:

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

Which initialized mysql again and generated a temporary password for root. I started the mysqld.service and logged into the root account using the temp password.

Thank you, everyone, for all the help so far. I agree that the wiki page should be updated.

Offline

#7 2019-01-08 17:48:43

hoschi
Member
From: Ulm (Germany)
Registered: 2008-11-03
Posts: 458

Re: [SOLVED] mysql_install_db command is missing after installing mysql

Sure? I think the directory must already exist, at least for PerconaDB from the official repositories:

The server checks for the existence of the data directory as follows:

    If no data directory exists, the server creates it.

    If a data directory exists but is not empty (that is, it contains files or subdirectories), the server exits after producing an error message:

[ERROR] --initialize specified but the data directory exists. Aborting.

So I deleted /var/lib/mysql and tried it:

mysqld --initalize --user=mysql --basedir=/usr --datadir=/var/lib/mysql
mysqld: Can't change dir to '/var/lib/mysql/' (OS errno 2 - No such file or directory)
...

It works with an empty data directory. I think the Wiki need to split up instructions for MySQL and PerconaDb from MariaDB. Furthermore MySQLWorkbench has some problems with MariaDB and vice versa, which is the reason why I prefer PerconaDB. MariaDB just doesn't offer a good native UI on Linux neutral

NetBeans is also a mess nowadays, Thanks Oracle. Yep, I'm frustrated.

Last edited by hoschi (2019-01-08 17:50:55)

Offline

#8 2019-01-08 18:06:16

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] mysql_install_db command is missing after installing mysql

You know better than to necrobump a solved thread.



Closing


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB