Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.0.20, 10.1.5
-
None
-
10.0.22
Description
If the "mysql" client is not found in $PATH, then mysql_secure_installation won't find it from in basedir:
[gmontee@localhost mariadb-10.1.5-linux-x86_64]$ ./bin/mysql_secure_installation -u root --basedir=/tmp/mariadb-10.1.5-linux-x86_64/
|
print: /tmp/mariadb-10.1.5-linux-x86_64//bin/my_print_defaults
|
|
FATAL ERROR: Could not find mysql
|
|
The following directories were searched:
|
|
/tmp/mariadb-10.1.5-linux-x86_64//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.
|
But it will find it if added to $PATH:
[gmontee@localhost mariadb-10.1.5-linux-x86_64]$ export PATH=$PATH:/tmp/mariadb-10.1.5-linux-x86_64/bin
|
[gmontee@localhost mariadb-10.1.5-linux-x86_64]$ ./bin/mysql_secure_installation -u root --basedir=/tmp/mariadb-10.1.5-linux-x86_64/
|
print: /tmp/mariadb-10.1.5-linux-x86_64//bin/my_print_defaults
|
|
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
|
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
|
|
In order to log into MariaDB to secure it, we'll need the current
|
password for the root user. If you've just installed MariaDB, and
|
you haven't set the root password yet, the password will be blank,
|
so you should just press enter here.
|
|
Enter current password for root (enter for none):
|
I think the bug happens because bindir is set to use basedir here: https://github.com/MariaDB/server/blob/d258f5ff0435cbd8b000226dc7dc3ec4e9b79cbc/scripts/mysql_secure_installation.sh#L176
But then find_in_basedir is called here: https://github.com/MariaDB/server/blob/d258f5ff0435cbd8b000226dc7dc3ec4e9b79cbc/scripts/mysql_secure_installation.sh#L184
Which adds basedir to the path again here: https://github.com/MariaDB/server/blob/d258f5ff0435cbd8b000226dc7dc3ec4e9b79cbc/scripts/mysql_secure_installation.sh#L83
So if basedir is /usr/local/mysql, it will search for /usr/local/mysql/usr/local/mysql/bin/mysql.
Attachments
Issue Links
- links to
Activity
Field | Original Value | New Value |
---|---|---|
Description |
If the "mysql" client is not found in $PATH, then mysql_secure_installation won't find it from in basedir: {code} This appears to be a bug. I've reproduced it on my end. I'll submit a JIRA issue. If it really is checking that directory, I'm not yet sure why it isn't finding the mysql binary. Regardless, temporarily adding MariaDB's bin directory to $PATH got it to work for me. [gmontee@localhost mariadb-10.1.5-linux-x86_64]$ ./bin/mysql_secure_installation -u root --basedir=/tmp/mariadb-10.1.5-linux-x86_64/ print: /tmp/mariadb-10.1.5-linux-x86_64//bin/my_print_defaults FATAL ERROR: Could not find mysql The following directories were searched: /tmp/mariadb-10.1.5-linux-x86_64//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. {code} But it will find it if added to $PATH: {code} [gmontee@localhost mariadb-10.1.5-linux-x86_64]$ export PATH=$PATH:/tmp/mariadb-10.1.5-linux-x86_64/bin [gmontee@localhost mariadb-10.1.5-linux-x86_64]$ ./bin/mysql_secure_installation -u root --basedir=/tmp/mariadb-10.1.5-linux-x86_64/ print: /tmp/mariadb-10.1.5-linux-x86_64//bin/my_print_defaults NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): {code} I think the bug happens because bindir is set to use basedir here: https://github.com/MariaDB/server/blob/d258f5ff0435cbd8b000226dc7dc3ec4e9b79cbc/scripts/mysql_secure_installation.sh#L176 But then find_in_basedir is called here: https://github.com/MariaDB/server/blob/d258f5ff0435cbd8b000226dc7dc3ec4e9b79cbc/scripts/mysql_secure_installation.sh#L184 Which adds basedir to the path again here: https://github.com/MariaDB/server/blob/d258f5ff0435cbd8b000226dc7dc3ec4e9b79cbc/scripts/mysql_secure_installation.sh#L83 So if basedir is /usr/local/mysql, it will search for /usr/local/mysql/usr/local/mysql/bin/mysql. |
If the "mysql" client is not found in $PATH, then mysql_secure_installation won't find it from in basedir: {code} [gmontee@localhost mariadb-10.1.5-linux-x86_64]$ ./bin/mysql_secure_installation -u root --basedir=/tmp/mariadb-10.1.5-linux-x86_64/ print: /tmp/mariadb-10.1.5-linux-x86_64//bin/my_print_defaults FATAL ERROR: Could not find mysql The following directories were searched: /tmp/mariadb-10.1.5-linux-x86_64//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. {code} But it will find it if added to $PATH: {code} [gmontee@localhost mariadb-10.1.5-linux-x86_64]$ export PATH=$PATH:/tmp/mariadb-10.1.5-linux-x86_64/bin [gmontee@localhost mariadb-10.1.5-linux-x86_64]$ ./bin/mysql_secure_installation -u root --basedir=/tmp/mariadb-10.1.5-linux-x86_64/ print: /tmp/mariadb-10.1.5-linux-x86_64//bin/my_print_defaults NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): {code} I think the bug happens because bindir is set to use basedir here: https://github.com/MariaDB/server/blob/d258f5ff0435cbd8b000226dc7dc3ec4e9b79cbc/scripts/mysql_secure_installation.sh#L176 But then find_in_basedir is called here: https://github.com/MariaDB/server/blob/d258f5ff0435cbd8b000226dc7dc3ec4e9b79cbc/scripts/mysql_secure_installation.sh#L184 Which adds basedir to the path again here: https://github.com/MariaDB/server/blob/d258f5ff0435cbd8b000226dc7dc3ec4e9b79cbc/scripts/mysql_secure_installation.sh#L83 So if basedir is /usr/local/mysql, it will search for /usr/local/mysql/usr/local/mysql/bin/mysql. |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Fix Version/s | 10.1 [ 16100 ] | |
Fix Version/s | 10.0 [ 16000 ] |
Assignee | Michael Widenius [ monty ] |
Assignee | Michael Widenius [ monty ] | Sergey Vojtovich [ svoj ] |
Sprint | 10.0.22 [ 17 ] |
Rank | Ranked higher |
Assignee | Sergey Vojtovich [ svoj ] | Sergei Golubchik [ serg ] |
Status | Confirmed [ 10101 ] | In Review [ 10002 ] |
Assignee | Sergei Golubchik [ serg ] | Sergey Vojtovich [ svoj ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Fix Version/s | 10.0.22 [ 19700 ] | |
Fix Version/s | 10.1.9 [ 20301 ] | |
Fix Version/s | 10.0 [ 16000 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Remote Link | This issue links to "Github revision (Web Link)" [ 25601 ] |
Workflow | MariaDB v3 [ 70675 ] | MariaDB v4 [ 149395 ] |