Where does mysql_ssl_rsa_setup get OpenSSL files? - mysql

Getting "openssl not installed on this system" when running mysql_ssl_rsa_setup.
I installed openssl and mysql from source, both times keeping the default paths for installation (/usr/local/openssl for openssl [I actually renamed it to openssl from ssl to see if that was the problem], /usr/local/mysql for mysql).
The docs say it gets the path from the PATH environment variable, but there's no option to specify it in the command line. What is the default? How to change it? I have seen that you can modify /etc/environment to add PATH there, but the file is empty by default.

According to 4.4.5 mysql_ssl_rsa_setup — Create SSL/RSA Files, mysql_ssl_rsa_setup uses the openssl command line tool:
Note
mysql_ssl_rsa_setup uses the openssl command, so its use is contingent
on having OpenSSL installed on your machine.
What is the default?
OpenSSL's default installation location is /usr/local/ssl
How to change it?
Use --openssldir when you configure the library. Also see Compilation and Installation on the OpenSSL wiki.
You should not install OpenSSL in /usr/bin (and the libraries in /usr/lib). Its creates too many problems.
Instead, let the library install itself in /usr/local/ssl. Then you should be able to create a shell script located at /usr/local/bin/openssl that performs the following:
$ cat /usr/local/bin/openssl
#!/usr/bin/env bash
LD_LIBRARY_PATH=/usr/local/ssl/lib:$LD_LIBRARY_PATH; /usr/local/ssl/bin/openssl "$#"
Be sure to chmod a+x /usr/local/bin/openssl.
You can verify the OpenSSL tool being used with:
$ which openssl
/usr/local/bin/openssl
If needed, add /usr/local/bin to your PATH:
$ cat ~/.bash_profile
export PS1="\\h:\\W$ "
export UMASK=0022
export EDITOR=emacs
export PATH="/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin"
...

Related

How to enable the OpenSSL 3.0 legacy provider Github Actions?

OpenSSL deprecated a set of hash functions in the 3.0 release. (See OpenSSL_3.0#Provider_implemented_digests.)
For a library I maintain, I need some of them for backward compatibility, e.g., RIPEMD160.
However, since OpenSSL 3.0 gets rolled out through various distributions, it now starts to fail on my Github actions with the latest Ubuntu 22.4 LTS image because it is now disabled by default.
So, further down the OpenSSL wiki page it explains how to enable the legacy features in the SSL config for the system. However, when I try to modify the system's openssl config file, I get a permission denied error even after using sudo.
sudo sed -i '/^\default = default_sect/a legacy = legacy_sect' /etc/ssl/openssl.cnf
sudo sed -i '/^\[default_sect\]/a activate = 1' /etc/ssl/openssl.cnf
sudo echo "[legacy_sect]" >> /etc/ssl/openssl.cnf
sudo echo "activate = 1" >> /etc/ssl/openssl.cnf
shell: /usr/bin/bash -e {0}
/home/runner/work/_temp/9f9803fe-a061-4d59-bed1-83d345569dbe.sh: line 3: /etc/ssl/openssl.cnf: Permission denied
If I cannot modify the config, how do I enable the OpenSSL 3.0 legacy provider Github Actions?
You don't need modify the system config file. You can create a new config file somewhere and then set the OPENSSL_CONF environment variable to point at it. Any process that uses openssl will use that environment variable as the location for its config file in preference to the system default location.

Installing OPAM System-Wide?

I've made a few attempts to install OPAM system-wide via Homebrew and opam init, but I haven't gotten it to work yet. How should I go about trying this again?
First of all it is not recommended to install it system wide. But if you still want, then this are the steps:
sudo brew install opam # installs opam executable system-wide
sudo mkdir -p /opt/opam # create a home for opam
sudo opam init --root=/opt/opam --comp=4.02.1
eval $(opam config env) # activate the environment
ocaml # run ocaml to make sure, that everything went fine
Some footnotes: I'm expecting that you've failed on your previous attempts, because you didn't specify the compiler version and didn't install system compiler. I still suggest you to reconsider, and install opam locally. To do that you need to perform the following:
brew install opam # installs opam executable system-wide
opam init --comp=4.02.1
eval $(opam config env) # activate the environment
ocaml # run ocaml to make sure, that everything went fine

configure: error: invalid MySQL root directory

I've a problem installing sphinx with percona 5.6 on centos 6.4.
I'm getting the following error while building from source:
******************************************************************************
ERROR: cannot find MySQL include files.
Check that you do have MySQL include files installed.
The package name is typically 'mysql-devel'.
If include files are installed on your system, but you are still getting
this message, you should do one of the following:
1) either specify includes location explicitly, using --with-mysql-includes;
2) or specify MySQL installation root location explicitly, using --with-mysql;
3) or make sure that the path to 'mysql_config' program is listed in
your PATH environment variable.
To disable MySQL support, use --without-mysql option.
******************************************************************************
Percona-Server-devel is installed:
rpm -qa | grep -i percona
percona-release-0.0-1.x86_64
Percona-Server-server-56-5.6.16-rel64.2.el6.x86_64
Percona-Server-client-56-5.6.16-rel64.2.el6.x86_64
Percona-Server-devel-56-5.6.16-rel64.2.el6.x86_64
Percona-Server-shared-56-5.6.16-rel64.2.el6.x86_64
What I've tried:
locate "libmysql"
/usr/lib64/libmysqlclient.so.18
/usr/lib64/libmysqlclient.so.18.0.0
/usr/lib64/libmysqlclient_r.so.18
/usr/lib64/libmysqlclient_r.so.18.0.0
/usr/lib64/mysql/libmysqlclient.so.16
/usr/lib64/mysql/libmysqlclient.so.16.0.0
/usr/lib64/mysql/libmysqlclient_r.so.16
/usr/lib64/mysql/libmysqlclient_r.so.16.0.0
/usr/lib64/mysql/libmysqlservices.a
than:
./configure --with-mysql=/usr/lib64/mysql --with-mysql-libs=/usr/lib64/mysql
./configure --with-mysql=/usr/lib64 --with-mysql-libs=/usr/lib64
./configure --with-mysql=/usr/bin/mysql --with-mysql-libs=/usr/bin/mysql
./configure --with-mysql=/usr
configure: error: invalid MySQL root directory '/usr/lib64/mysql';
neither bin/mysql_config, nor include/ and lib/ were found there
which mysql_config
/usr/bin/mysql_config
Have you tried installing mysql-devel ?
sudo yum install mysql-devel
If properly setup, try as suggested in the error message to point to these libs manually using a command like the following one (to be adapted to your environment)
./configure --with-mysql-includes=/usr/local/src/mysql-XXX/include

How can I configure gem install to use "install" from the right place?

When I try to install rails using gem on my Arch Linux machine, I get the following error:
$ gem install rails
...
...
make install
/usr/bin/install -c -m 0755 bcrypt_ext.so /home/gphilip/.rvm/gems/ruby-1.9.3-preview1/gems/bcrypt-ruby-3.0.1/lib
make: /usr/bin/install: Command not found
make: * [/home/gphilip/.rvm/gems/ruby-1.9.3-preview1/gems/bcrypt-ruby-3.0.1/lib/bcrypt_ext.so] Error 127
It turns out that on Arch Linux, the "install" binary is located at /bin/install. So on my system I have:
$which install
/bin/install
$
Since I have root access (it is my laptop!), I could easily "fix" this by creating a symlink at /usr/bin/install , but how would I do this otherwise?
How do I configure gem to use the "install" command from /bin/ instead of insisting on using the one in /usr/bin/ ?
I am asking this in case I am in a situation where I face the same problem and I don't have permissions to create symlinks in arbitrary places.
Find rbconfig.rb file in your ruby installation dir (example for my machine):
$ which ruby
/home/valentin/.rvm/rubies/ruby-1.8.7-p352/bin/ruby
$ find /home/valentin/.rvm/rubies/ruby-1.8.7-p352 -name rbconfig.rb
/home/valentin/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/x86_64-linux/rbconfig.rb
In that file change line
CONFIG["INSTALL"] = '/usr/bin/install -c'
to
CONFIG["INSTALL"] = '/bin/install -c'
(Or whichever is the correct install path, I've had to change it back to /usr/bin, for example)
You might want to update other paths as well.
Or, you can just reinstall ruby.

Trying to install Perl-Mysql DBD, mysql_config can't be found

Here's the output:
Ian-MacBook-Pro:DBD-mysql-4.011 ianseyer$ sudo Perl Makefile.PL
Can't exec "mysql_config": No such file or directory at Makefile.PL line 76.
Cannot find the file 'mysql_config'! Your execution PATH doesn't seem
not contain the path to mysql_config. Resorting to guessed values!
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
PLEASE NOTE:
For 'make test' to run properly, you must ensure that the
database user 'root' can connect to your MySQL server
and has the proper privileges that these tests require such
as 'drop table', 'create table', 'drop procedure', 'create procedure'
as well as others.
mysql> grant all privileges on test.* to 'root'#'localhost' identified by 's3kr1t';
You can also optionally set the user to run 'make test' with:
perl Makefile.pl --testuser=username
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Failed to determine directory of mysql.h. Use
perl Makefile.PL --cflags=-I
to set this directory. For details see the INSTALL.html file,
section "C Compiler flags" or type
perl Makefile.PL --help
I've researched the issue and tried making a symlink to no avail.
Do I have to compile this myself?
If you installed the mysql server that everybody installs:
sudo apt-get install mysql-server (or something like this)
you are missing a few extra files on which the makefile for this perl module depends.
You can try to work around this issue by installing the following package:
sudo apt-get install libmysqlclient-dev
REFERECE:
http://cpansearch.perl.org/src/RUDY/DBD-mysql-2.9008/INSTALL.html#configuration
Applying to ubuntu/debian users (I'm running U-12.0.4), it was suggested above that users do:
sudo apt-get install libmysqlclient-dev
But then there is another problem with the maketest portion of the install where the "password: NO" FAILED. To bypass that test, just use force:
sudo cpan -f DBD::mysql
if u r using ubuntu , u can easily install using the below cmd
sudo apt-get install libdbd-mysql-perl
for more detail check the cpan install.pod consist detail about other Linux flavor
Install the mysql-devel package that pertains to your distro and mysql server version.
You just need mysql-server and mysql-devel installed locally so that cpan can build the module, you can probably remove the mysql server afterwards.
Find the script mysql_config.pl under your MySQL directory, and run Makefile.PL like:
perl Makefile.PL --mysql_config=/path/to/mysql-5.x.y.zzz/bin/mysql_config.pl
If you try to install via CPAN you cannot, as far as I know, set the --mysql_config option directly. And, including the directory containing mysql_config in the PATH environment variable does not seem to help.
However, if you do have the file mysql_config available somewhere, you can do the following to make the install succeed:
ln -s /path/to/mysql_config /usr/local/bin/
Then, remove the symbolic link after the DBD::mysql installation.
The tests during install will still fail, unless you have installed MySQL in some central/default location on your system, but installation will still succeed.
If you do not have mysql_config available, you can get it from a tar.gz download of the MySQL Community Server from mysql.com. It will be located in the bin/ subdirectory of the extracted files. If you want to have MySQL installed on your system, a better option is probably to download the RPMs and install them, or install via the package management system of your OS.
Try yum install mariadb-devel for CentOS 7 and then
run the required Perl module installation such as cpan DBD::mysql
I was getting make test errors. This helped me;
perl Makefile.PL --testuser=bob --testpass=bobtest
I solved installing libmariadbclient-dev, libmariadb-dev and mariadb-client on debian 9.13
apt install mariadb-client libmariadbclient-dev libmariadb-dev