ln: /usr/lib/libmysqlclient.18.dylib: File exists - mysql

rake aborted!
dlopen(/Users/ava/.rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/lib/libmysqlclient.18.dylib
Referenced from: /Users/ava/.rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/ava/.rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle`
Ran the following to resolve:
$ sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib \
/usr/lib/libmysqlclient.18.dylib
ln: /usr/lib/libmysqlclient.18.dylib: File exists
My setup:
OSX 10.8.4
MySQL 5.1.71
libmysqlclient.16.dylib
$ locate libmysqlclient.16.dylib
/usr/lib/libmysqlclient.16.dylib
/usr/local/Cellar/mysql51/5.1.71/lib/mysql/libmysqlclient.16.dylib
libmysqlclient.18.dylib
$ locate libmysqlclient.18.dylib
/usr/lib/libmysqlclient.18.dylib
In .bash_profile, I have
export PATH="/usr/local/bin:$HOME/.rvm/bin:$HOME/bin:$PATH"
export DYLD_LIBRARY_PATH=/usr/local/bin/mysql
How to get this rake running? Am I supposed to have libmysqlclient.18.dylib under /usr/local/Cellar/mysql51/5.1.71/lib/mysql too? If yes, how do I create it?

Sorry, if I am mistaken; there is no Mac to check in details.
The error message clearly states, that the library mysql wants is:
/usr/local/lib/libmysqlclient.18.dylib
while the library you have is:
/usr/lib/libmysqlclient.18.dylib
That definitely means, that your mysql installation is somehow broken, but for the quick patch I would recommend soft linking:
$ sudo ln -s /usr/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib
You have likely misplaced arguments within your first solution try.

Instruct Mac OS X to find it as follows, if you are using Bash:
In your ~/.bash_profile:
export DYLD_LIBRARY_PATH=<location of mysqlclient.18.dylib>:$DYLD_LIBRARY_PATH
Restart terminal.
For example, I have the following:
$ ls -ld /usr/local/m*
lrwxr-xr-x 1 root admin 27 May 5 14:28 /usr/local/mysql -> mysql-5.6.13-osx10.7-x86_64
drwxr-xr-x 3 root wheel 102 May 5 13:13 /usr/local/mysql-5.5.29-osx10.6-x86
drwxr-xr-x 17 root wheel 578 May 5 13:13 /usr/local/mysql-5.6.13-osx10.7-x86_64
$ head ~/.bash_profile
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH

Related

mysql install init failure on centos7

I am trying to install Mysql Community Server version5.6.40 on my Centos7 VM.
During the installation i have met below problems:
1)
[root#Mysql_Server scripts]# ./mysql_install_db.sh --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
-bash: ./mysql_install_db.sh: Permission denied
[root#Mysql_Server support-files]# /etc/init.d/mysqld start
-bash: /etc/init.d/mysqld: Permission denied
i have use chmod a+x filename to assign the execute rights but i just want to know why those files lacks of execution rights. //i download the mysql installation tar file and extract with root privilege
2)while i was running the mysql_install_db.sh
[root#Mysql_Server scripts]# ./mysql_install_db.sh --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
FATAL ERROR: Could not find my_print_defaults
The following directories were searched:
/application/mysql/bin
/application/mysql/extra
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 tried follow steps to find out what the possible reason for causing this issue:
find / my_print_defaults
find: ‘my_print_defaults’: No such file or directory
and
ls /application/mysql/
[root#Mysql_Server scripts]# ls /application/mysql/
BUILD dbug libmysqld README support-files
client Docs libservices regex tests
cmake Doxyfile-perfschema man scripts unittest
CMakeLists.txt extra mysql-test sql VERSION
cmd-line-utils include mysys sql-bench vio
config.h.cmake INSTALL mysys_ssl sql-common win
configure.cmake libevent packaging storage zlib
COPYING libmysql plugin strings
no bin and extra directory were created.
so i was wondering if it was caused by lacking of gcc gcc-c++ because my centos7 installation chose minimal install.
or maybe it was caused by lacking of execution rights result the shell files did run correctly.
attached:below whole operations for better trouble shooting
[root#Mysql_Server ~]# yum install wget -y
[root#Mysql_Server ~]# wget https://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.40.tar.gz
[root#Mysql_Server ~]# tar -xf mysql-5.6.40.tar.gz
[root#Mysql_Server ~]# mkdir /application
[root#Mysql_Server ~]# mv mysql-5.6.40 /application/
[root#Mysql_Server ~]# ln -s /application/mysql-5.6.40/ /application/mysql
[root#Mysql_Server ~]# cd /application/mysql/support-files/
[root#Mysql_Server support-files]# cp my-default.cnf.sh /etc/my.cnf
[root#Mysql_Server support-files]# cp mysql.server.sh /etc/init.d/mysqld
[root#Mysql_Server support-files]# cd /application/mysql/scripts/
[root#Mysql_Server scripts]# useradd mysql -s /sbin/nologin -M
[root#Mysql_Server scripts]# chmod a+x mysql_install_db.sh
[root#Mysql_Server scripts]# ./mysql_install_db.sh --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
It is a fatal mistake by misunderstanding between the source code and binary package.
Since i downloaded the source code which can not be run directly without encoding and packaging.
Thanks again for #danblack's reminds!
I've successfully run mysql_community_server on centos7 now.(using the binary package installed).
now i am going to install mysql by using the source code.

Installation Requirements for mysql with DBIish on rakudo-star docker image

I was creating an own docker image based on the latest rakudo-star docker image. I wanted to use DBIish to connect to a mysql database. Unfortunately I am not able to get the DBDish::mysql to work.
I've installed default-libmysqlclient-dev as you can see in
# find / -name 'libmysqlclient*.so'
/usr/lib/x86_64-linux-gnu/libmysqlclient_r.so
/usr/lib/x86_64-linux-gnu/libmysqlclient.so
The error i am facing is:
# perl6 -Ilib -e 'use DBDish::mysql; DBDish::mysql.connect()'
Cannot locate native library 'mysqlclient': mysqlclient: cannot open shared object file: No such file or directory
in method setup at /usr/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 289
in method CALL-ME at /usr/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 539
in method connect at /root/DBIish/lib/DBDish/mysql.pm6 (DBDish::mysql) line 12
in block <unit> at -e line 1
Short answer: you need the package libmysqlclient20 (I added the documentation request to a similar DBIish issue). Debian 9 (stable at the moment) uses and older version than Ubuntu 18.04 (stable at the moment) and Debian Unstable. It also refers to mariadb instead of mysql. Pick libmariadbclient18 on images based on Debian Stable and create a link with the mysql name (see below).
On Debian Testing/Unstable and recent derivatives:
$ sudo apt-get install libmysqlclient20
$ dpkg -L libmysqlclient20
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.3.9
/usr/share
/usr/share/doc
/usr/share/doc/libmysqlclient20
/usr/share/doc/libmysqlclient20/NEWS.Debian.gz
/usr/share/doc/libmysqlclient20/changelog.Debian.gz
/usr/share/doc/libmysqlclient20/copyright
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.20
On Debian 9 and derivatives:
$ dpkg -L libmariadbclient18
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libmariadbclient.so.18.0.0
/usr/lib/x86_64-linux-gnu/mariadb18
/usr/lib/x86_64-linux-gnu/mariadb18/plugin
/usr/lib/x86_64-linux-gnu/mariadb18/plugin/client_ed25519.so
/usr/lib/x86_64-linux-gnu/mariadb18/plugin/dialog.so
/usr/lib/x86_64-linux-gnu/mariadb18/plugin/mysql_clear_password.so
/usr/share
/usr/share/doc
/usr/share/doc/libmariadbclient18
/usr/share/doc/libmariadbclient18/changelog.Debian.gz
/usr/share/doc/libmariadbclient18/copyright
/usr/lib/x86_64-linux-gnu/libmariadbclient.so.18
Create the link:
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libmariadbclient.so.18 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
In order to illustrate this, I created an Ubuntu 18.04 container for the occasion*:
docker run -ti --rm --entrypoint=bash rakudo/ubuntu-amd64-18.04
And the abbreviated commands and output:
# apt-get install -y libmysqlclient20 build-essential
# zef install DBIish
# perl6 -e 'use DBDish::mysql; DBDish::mysql.connect()'
Cannot look up attributes in a DBDish::mysql type object
[...]
The error is because I didn't pass the correct parameters for connect as I didn't have a db running. The important thing is that no .so file is missing.
*: I uploaded it to the Docker Hub, a normal run will put you right in the REPL:
$ docker run -ti --rm rakudo/ubuntu-amd64-18.04
To exit type 'exit' or '^D'
>
(I didn't use the Star image when debugging, but it does not matter because this is a more generic problem.)

/usr/sbin/mysqld: error while loading shared libraries: liblz4.so.1: cannot open shared object file: Permission denied

I'm installing mariadb on ubuntu 16.04.
After Installed, when I run mysql status/start, it always throws the below error
root#3ab94b27a215:~# service mysql status
/usr/sbin/mysqld: error while loading shared libraries: liblz4.so.1: cannot open shared object file: Permission denied
* MariaDB is stopped.
I find the file here
root#3ab94b27a215:~# find / -name liblz4.so.1
/usr/lib/x86_64-linux-gnu/liblz4.so.1
I set 777 permission to /usr/lib/x86_64-linux-gnu/liblz4.so.1
chmod 777 /usr/lib/x86_64-linux-gnu/liblz4.so.1
but still the error not resolved.
can you please help me on this?
This worked for me :-
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
It also disables the AppArmor for MySQL on the system though.
Got from this issue
This is what worked for me
Follow the steps below to remove mysqld from the app armor:
$ echo "/usr/sbin/mysqld { }" | sudo tee /etc/apparmor.d/usr.sbin.mysqld
$ sudo apparmor_parser -v -R /etc/apparmor.d/usr.sbin.mysqld
$ sudo systemctl restart mariadb
Had the same problem after mariad install and changing datadir to /home/myuser/mysql. This was the issue: https://stackoverflow.com/a/41558145/4556066 ProtectHome=false

Getting MySQL installed

I have downloaded mysql-5.6.17-osx10.7-x86.tar.gz from here. Now I've got a folder full of MySQL-related files. Trouble is, I don't know what to do to install MySQL. I tried executing mysql_install_db, but the result was:
Last login: Sat May 24 10:45:08 on ttys000
host237-40-dynamic:~ michelegorini$ /Users/michelegorini/Downloads/mysql-5.6.17-osx10.7-x86/scripts/mysql_install_db ; exit;
FATAL ERROR: Could not find ./bin/my_print_defaults
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.
logout
[Process completed]
So what do I do now?
Update:
Taking the answer into account, I tried something, with this result:
Last login: Sat May 24 10:45:08 on ttys000
host237-40-dynamic:Hakka_ michelegorini$ $ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
curl: (22) The requested URL returned error: 400
-bash: $: command not found
host237-40-dynamic:Hakka_ michelegorini$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" && brew install git &&
> brew update
curl: (22) The requested URL returned error: 400
-bash: brew: command not found
host237-40-dynamic:Hakka_ michelegorini$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" && brew install git && brew update && brew install mysql
curl: (22) The requested URL returned error: 400
-bash: brew: command not found
host237-40-dynamic:Hakka_ michelegorini$
What now?
The homebrew package manager takes away the pain in installing packages on your computer.
Here's how to install mysql on a mac
The command in one line:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" && brew install git && brew update && brew install mysql

Mysql2::Error: Can't read dir of './ppml_development/' (errno: 13): SHOW TABLES

I get this error:
Mysql2::Error: Can't read dir of './site_development/' (errno: 13): SHOW TABLES
whenever I try to query the db of any of my rails apps that use mysql. The same error shows up within the mysql> env when I log in as Rails user and SHOW TABLES;. This problem surfaced after installing node, npm, and coffee-script. I think the problem is a permissions issue as both npm and mysql are in /usr/local/. Per the instructions in Trevor Burnham's Coffeescript book, I used the following commands during the install process:
sudo mkdir -p $PREFIX/{share/man,bin,lib/node,include/node}
sudo chown -R $USER $PREFIX/{share/man,bin,lib/node,include/node}
sudo chown -R dowdjj local
When I run:
sudo ls -l
within /usr/local/mysql/data it shows root:wheel for the permissions for all databases, including ppml_development. I'm guessing this is an easy fix, but just out of my league as a newbie. Thanks in advance.