mysql_config not found with mysql-community on CentOS 7 - mysql

I need to install mysqlclient module for python3.6 on my CentOS server via pip.
The instalation breaks with following error: OSError: mysql_config not found.
I've found a solution, to install mysql-devel package, but unfortunately it breaks with following error:
Error: mariadb101u-config conflicts with mysql-community-server-8.0.4-0.1.rc.el7.x86_64
Error: mariadb101u-libs conflicts with mysql-community-libs-8.0.4-0.1.rc.el7.x86_64
Error: mariadb101u-libs conflicts with mysql-community-libs-compat-8.0.4-0.1.rc.el7.x86_64
Error: mariadb101u-common conflicts with mysql-community-common-8.0.4-0.1.rc.el7.x86_64
I cannot remove the mysql-community packages, because the server is running MySQL database based on that.
Is there any way to fix it without removing conflicting packets?

Ok, found an answer:
yum install mariadb-devel gcc python36u-devel

Solution by #Djent worked for me.
But I kept on receiving time out error while installing through yum. If you are having the same problem. You can manually download the package and install it!
On CentOS
wget https://archive.mariadb.org/mariadb-10.1.39/yum/centos7-amd64/rpms/MariaDB-10.1.38-centos73-x86_64-devel.rpm
rpm -i MariaDB-10.1.38-centos73-x86_64-devel.rpm
For other linux OS, you can find mariadb-devel at https://pkgs.org/download/mariadb-devel

First run the command (take note of python version):
sudo yum install python36-devel
Then install mysqlclient using pip.

Related

How to link mysql-client installed from Homebrew with diesel-cli?

I have been trying to install the Rust Diesel CLI tool using cargo install diesel_cli, but the installation fails with a linking error
ld: library not found for -lmysqlclient
clang: error: linker command failed with exit code 1
(use -v to see invocation)
I installed the MySQL client using Homebrew: brew install mysql-client. During installation I got the following warning:
mysql-client is keg-only, which means it was not symlinked into /usr/local,
because conflicts with mysql.
If you need to have mysql-client first in your PATH run:
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
For compilers to find mysql-client you may need to set:
export LDFLAGS="-L/usr/local/opt/mysql-client/lib"
export CPPFLAGS="-I/usr/local/opt/mysql-client/includeā€¯
I set the PATH and flags as in that warning message, but I still get the above linking error when trying to install the diesel-cli tool. I am unfamiliar with how to do linking in Rust - are there extra steps I need to do here to link mysqlclient directly?
Cargo ignores LDFLAGS and CPPFLAGS, you should set RUSTFLAGS instead. Something like this untested invocation:
RUSTFLAGS="-L/your_lib -I/your_include" cargo install diesel_cli
Relevant documentation.
On my side, I did not make it work with a mysql-client only. I had to install mysql with
brew install mysql
In the end, what matters is that you have a version of the mysqlclient dynamic lib.
Mines where installed here :
/usr/local/lib/libmysqlclient.21.dylib
/usr/local/Cellar/mysql/8.0.15/lib/libmysqlclient.21.dylib
And it worked.

Install / Update mysql-connector for Python

I have had no success at installing the MySQL Python connector on ubuntu 14.04. it appears that the production environment has version 1.1.6 installed. I have tried removing it with both pip and apt-get. I have attempted to update it also and have had no luck.
The command below does not work, I have tried with both "mysql-connector" and "mysql-connector-python"
pip install --user --allow-external mysql-connector-python mysql-connector-python
`
Downloading/unpacking mysql-connector-python Could not find any
downloads that satisfy the requirement mysql-connector-python Cleaning
up... No distributions at all found for mysql-connector-python
Storing debug log for failure in /root/.pip/pip.log`
If I run the command above, with just mysql-connector, it fails with an error about external managment.
"error: option --single-version-externally-managed not recognized"
I have also tried to manually remove it from "/usr/lib/python2.7/dist-packages/mysql_connector_python-1.1.6.egg-info" and that seems to have made no difference.
I have also downloaded the .deb from MySQL:
"mysql-connector-python-cext_2.1.3-1ubuntu14.04_amd64.deb" and used dpkg to install it, but that fails, as well as update fails.
Any advice?

Uninstall Share Lib In Linux

I have tried to install MYSQL 5.6.29 on Linux Centos and installed file "MySQL-shared-5.6.29-1.linux_glibc2.5.x86_64" but i found its wrong file which i have installed. Now when i am trying to install correct file "MySQL-shared-5.6.29-1.el6.x86_6" then getting below error.
/usr/share/doc/MySQL-shared-5.6.29/README from install of MySQL-shared-5.6.29-1.el6.x86_64 conflicts with file from package MySQL-shared-5.6.29-
1.linux_glibc2.5.x86_64
My installation was incomplete and only able to install 3 rpm packages. I run "yum remove mysql" but its un-install only one package please guide me to find & un-install MYSQL related packages.
issue fixed through these commands:
rpm -qa|grep -i SQL -- find installed rpm packages
rpm -e -- find installed package and then place the package name
rpm -i package_name.rpm -- to install packages
yum remove mysql-libs

Create a symlink for the libmysqlclient.18.dylib library

I have installed mysql through a pkg installer.
I am trying to start rails server and I am getting the following error.
Library not loaded: libmysqlclient.18.dylib (LoadError)
I am reading that a solution to that is to create a symlink like
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
There is no
/usr/local/mysql/lib/libmysqlclient.18.dylib
file only a
/usr/local/mysql/lib/libmysqlclient.20.dylib file.
I run
sudo find /usr/ -name libmysqlclient.18.dylib
and I can't find the libmysqlclient.18.dylib file.
I encountered a problem like this while setting up a new development environment. I had installed MySQL via homebrew, which gave me version 5.7.9 of MySQL, with the library version libmysqlclient.20.dylib.
In my case, I was setting up a python project. The requirements install failed because the python-MySQL connection piece was looking for libmysqlclient.18.dylib, which was nowhere to be found on my machine.
Downgrading to MySQL 5.6 solved the issue for me:
brew uninstall mysql
brew tap caskroom/versions
brew install mysql56
Now /usr/local/lib/libmysqlclient.18.dylib is present and everything's peachy.
The mysql2 gem which is most likely in your Rails environment is still looking for libmysqlclient.18.dylib (from what must have been a previous mysql install) but the library is no longer there because the recent manual install/upgrade replaced it with libmysqlclient.20.dylib.
The easy fix is to install again mysql2:
gem uninstall mysql2 && gem install mysql2
or better yet:
gem uninstall mysql2 && bundle, if you are on Bundler.
I did not have mysql installed through brew or gem, and was facing the same issue that it was looking for libmysqlclient.18.dylib instead of libmysqlclient.20.dylib. I tried everything mentioned here and at some other threads. Nothing worked. Finally, this worked for me:
pip install mysqlclient
It does not install libmysqlclient.18.dylib, but solves the library not installed and image not found errors.
Hope it helps someone!
Uninstall mysqlclient
Clear cache of your pip
Find folder in which pip wheel cache is stored for mysqlclient and delete it.
Reinstall mysqlclient
mac mojave OS cache will be in this folder: ~/Library/Caches/pip. Follow the steps below:
Find ~/Library/Caches/pips/wheels/ | grep mysql
Delete the file you got.
pip install mysqlclient

linux mysql-server can't find mysql_config

I have a running (in production) mysql instance on my linux server (ubuntu-10.10) however I cannot find my mysql_config file.
command and output:
~$ locate mysql_config
~$
I've heard/read that I need the libmysqlclient-dev package installed to be able to use mysql_config but I don't want to break my current production instance. I want to make sure installing this dev package is not going to have adverse effects on my current mysql databases.
Furthermore, where can I find the source download for libmysqlclient-dev to install manually? In my current situation (behind corporate proxy) I am not permitted to use apt-get's.
UPDATE
this is stemming from attempting to install python-MySQLdb from source. the setup.py file is requiring the mysql_config path and continues to break when trying to use anything but that file.
The mysql_config executable is by default located in the bin directory of the MySQL server installation if you install it from precompiled binaries. But if you install it using apt-get it may not exist on your server.
Try:
sudo apt-get install libmysqlclient-dev
yum install mariadb-devel works for Centos 7 too, this puts the mysql_config into all the places that pip install mysqlclient requires/looks for it.
In Ubuntu 13.04 installation, it is at /usr/bin/mysql_config
Try /etc/my.cnf, that is the standard file for mysql config.
You can also do:
find / -name my.cnf -type f
On Fedora, install the mariadb-devel package, and you should have the binary.