I am following the instruction on the MariaDB site here all is fine until I get to the part shown below.
[root@squir scripts]# mysql_install_db --defaults-file=/mariadb/data/my.cnf
FATAL ERROR: Could not find mysqld
The following directories were searched:
/mariadb/mariadb/libexec
/mariadb/mariadb/sbin
/mariadb/mariadb/bin
If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.
I wonder if there is the problem with the directory structure that is confusing the install. The documentation is also old, so I am not sure if there is a step missing.
What I Have done So far
- Downloaded the MariaDB.tar.gz
- Created a directory called /mariadb/
- Extracted the MariaDB.tar.gz and created a symbolic link called mariadb
- Created a user group and username for MariaDB directory
- Created /mariadb/data for storing MariaDB data file (Database)
-
Copy the pre-written configuration file by this command.
cp mariadb/support-files/my-medium.cnf mariadb/data/my.cnf
-
Edited the my.cnf file as per instructed in here
[client]
port = 3307
socket = /mariadb/data/mariadb.sock[mysqld]
datadir = /mariadb/data
basedir = /mariadb/mariadb
port = 3307
socket = /mariadb/data/mariadb.sock
user = mariadb -
Copy the init.d script from support files in the right location:
- Edit /etc/init.d/mariadb replacing mysql with mariadb
-
Run mysql_install_db by explicitly giving it the my.cnf file as argument:
scripts/mysql_install_db –defaults-file=/opt/mariadb-data/my.cnf
Although on step 10, I can't follow this command. So I did what I stated above and shown the error.
Best Answer
basedir
is "base" directory, where allbin
lib
etc directories reside.Change
basedir = /mariadb/mariadb
tobasedir = /mariadb
.Also, I guess
my.cnf
location is somewhere at/mariadb/data/my.cnf
, change--defaults-file=/opt/mariadb-data/my.cnf
accordingly.Also,
mysql_install_db
must run from/mariadb
withscripts/mysql_install_db
mysql_install_db
will call script from/usr/bin
, not the one from/mariadb/scripts/
.It's better to follow standards and install it under
/opt/
.Also, be sure selinux is in permissive mode:
getenforce
set "permissive" in
/etc/sysconfig/selinux