1

Please excuse me if the question is misleading. I'm trying to understand the way the environment settings work for the user "mysql".

I'm following this guide to connect an Oracle DB from a MariaDB installation.

I had managed to install the required libraries and succeed to connect from the root command line.

But when trying to connect from MariaDB I get this message:

[unixODBC][Driver Manager]Can't open lib '/home/oraclec/instantclient_12_1/libsqora.so.12.1' : file not found

The same happened the first time I tried to connect from the root command line and I solved it adding these lines to the /root/.bash_profile file:

CLIENT_HOME=/home/oraclec/instantclient_12_1 ; export CLIENT_HOME
LD_LIBRARY_PATH=/home/oraclec/instantclient_12_1 ; export LD_LIBRARY_PATH

So, I'm trying to do the same thing for the user "mysql" but there is no a .bash_profile for this user.

In conclusion, where should I put these paths in order to get the user "mysql" access them?

Note: The server is running CentOS 6.5.

Memochipan
  • 327
  • 1
  • 2
  • 11

2 Answers2

3

You can pass your variables to mysql from its init script. e.g /etc/init.d/mysql.

If you still need to create a .bash_profile (or .bashrc) for the mysql user, do this:

vi ~mysql/.bash_profile

If there is no home for that user, create one and update /etc/passwd.

Memochipan
  • 327
  • 1
  • 2
  • 11
Ryan Babchishin
  • 6,160
  • 2
  • 16
  • 36
  • I tried creating a `.bash_profile` file under `/var/lib/mysql` but it doesn't work. This is the result of the `cat /etc/passwd` command: `mysql:x:498:498:MySQL server:/var/lib/mysql:/bin/bash` – Memochipan Oct 03 '15 at 16:32
  • 1
    I don't have mysql installed in front of me at the moment. What if you pass your variables to mysql from it's init script? Like /etc/init.d/mysql. – Ryan Babchishin Oct 03 '15 at 16:36
  • That seems to be a good idea! I will give it a try. I was trying to create a script inside `/etc/profile.d`. – Memochipan Oct 03 '15 at 16:39
0

It should not hurt to set it for all users in /etc/bash.bashrc.

Instead of using LD_LIBRARY_PATH variable, you can also add library path in /etc/ld.so.conf. Don't forget to run ldconfig after.

sam_pan_mariusz
  • 2,053
  • 1
  • 12
  • 15