Compiler error mysql.h not found - mysql

On compiling a software I get this error
mysql/mysql.h: No such file or directory
result of running mysql_config --include is
-I/usr/local/mysql/include
How can I get mysql.h to be detected?

Install mysql development packages on Debian/ubuntu.
sudo apt-get install libmysqld-dev
on CentOs/Redhat (to know who provide - yum provides mysql/mysql.h):
sudo yum install mysql-devel

While building Kamailio from sources on CentOS / Fedora, I encountered mysql/mysql.h: No such file or directory
Since my target was MariaDB, installing mariadb-devel package helped
# yum -y install mariadb-devel
Before installing above package, it was necessary for me to clean-up previously installed MariaDB-client package.
# yum remove MariaDB-client
# yum remove MariaDB-common
# mv /etc/yum.repos.d/mariadb.repo /etc/yum.repos.d/mariadb.repo.bak
If necessary we can get back the original MariaDB-client package after the build process, such as
# mv /etc/yum.repos.d/mariadb.repo.bak /etc/yum.repos.d/mariadb.repo
# yum -y install MariaDB-client

Related

Using APT after installing package by DPKG

As I know "dpkg -i package.deb" installs given package. But why in this case after dpkg, apt is used for installing zabbix modules? Should`t it be installed by DPKG?
# wget https://repo.zabbix.com/zabbix/5.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.4-1+ubuntu20.04_all.deb
# dpkg -i zabbix-release_5.4-1+ubuntu20.04_all.deb
# apt update
# apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
APT download the given modules from the repository. However, these modules can also be installed using DPKG by downloading the package manually from any repo.
Download it from
http://mirror.nullivex.com/zabbix/4.5/pool/main/z/zabbix/
and simply install it via dpkg -i package.deb.
Download all the packages like zabbix-server-mysql http://mirror.nullivex.com/zabbix/4.5/pool/main/z/zabbix/zabbix-server-mysql_5.0.0~rc1-1+jessie_amd64.deb
And simply install it via dpkg.

Unable to install Mysql community server on Debian 10

Hi I am unable to install mysql 8 on my newly installed Debian 10 machine.
Here is what I did:
$ cd /tmp
$ wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
$ sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb
After this ran
$ sudo apt update
$ sudp apt install mysql-server
I am getting the bellow error:
The following packages have unmet dependencies:
mysql-server : Depends: mysql-community-server (= 8.0.18-1debian10) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Not sure if dependencies are available in debian 10 repo.
Try your luck with installing the dependencies with
sudo apt update
sudo apt install -f

No package msyql-server available

I'm trying to set up MySQL on an Amazon Linux instance, I've tried everything (and with the -y option as well):
$ sudo yum install mysql-server
$ sudo yum install mysql56-server
$ sudo yum install mysql-community-server
I keep getting the "No package msqql-server available", "No package msyql56-server available", etc...
I've also ran yum clean all, yum update all, etc...
I'm assuming I have to install the RPM, but I don't know what version to install and while there is documentation for CentOS, there is little documentation specifically for Amazon Linux for setting up MySQL.
And these instructions didn't work as I got the error message "No package mysql56-server available" https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html
This worked:
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
sudo yum localinstall mysql57-community-release-el7-8.noarch.rpm
sudo yum install mysql-community-server
UPDATE for 2022:
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
sudo yum localinstall mysql57-community-release-el7-8.noarch.rpm
sudo yum install mysql-community-server
service mysqld start
ref:
https://support.cpanel.net/hc/en-us/articles/4419382481815?input_string=gpg+keys+problem+with+mysql+5.7

Installation of MySQL 5.7 on Debian 7 Wheezy

I would like to install MySql 5.7 on Debian 7 Wheezy. I put :
deb http://repo.mysql.com/apt/debian/ wheezy mysql-5.7
in file:
/etc/apt/sources.list.d/mysql.list
Next I run commands:
sudo apt-get update
sudo apt-get upgrade
And tried install package:
sudo apt-get install mysql-server-5.7
I got an error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'mysql-community-server' instead of 'mysql-server-5.7'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mysql-community-server : Depends: mysql-common (= 5.7.11-1debian7) but 5.5.47-0+deb7u1 is to be installed
Depends: mysql-client (= 5.7.11-1debian7)
E: Unable to correct problems, you have held broken packages.
Do you have any ideas to resolve this problem?
I also tried:
Note, selecting 'mysql-community-server' instead of 'mysql-server-5.7'
But it's not the solution of the problem.
I stumbled upon this post and can confirm simply changing the priority of your cache by downloading the .deb package directly from MySQL Downloads
Using the command line:
$ cd /usr/src && sudo wget http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
Please note: by convension the /src directory on linux exists for source code to live before being compiled - I believe the deb package above therefore belongs here.
This works for Debian/Wheezy.
$ sudo dpkg -i http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
Once this you have gone through the steps, you simply hit Ok, and then proceed to install mysql-server like normal:
$ sudo apt-update
$ sudo apt-get install mysql-server
For me, this resulted in the following:
[info] MySQL Community Server 5.7.14 is started.
Setting up mysql-server (5.7.14-1debian7) ...
Further reading, if you ever want to remove this package, you can do so:
$ cd /usr/src && sudo dpkg --remove http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
As of 2020 with Debian Wheezy 7.11 the answer doesn't work anymore. I had to change a few things and thought it might be useful to share the result:
Install mysql-apt-config_0.8.10-1_all.deb (Version 0.8.15-1_all won't work: dpkg can't handle the "control.tar.xz" it contains.)
cd /usr/src
sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb
This will create the necessary /etc/apt/sources.list.d/mysql.list file.
sudo apt-get update
sudo apt-get install mysql-server
Thanks goes to David Kehr from where I got the working mysql-apt-config version.
You don't need to specify the version in the apt-get command, just type :
sudo apt-get install mysql-server
After the install, you can type the following command to check mysql version
aptitude show mysql-server
On my machine I have the following result :
...
VersionĀ : 5.7.13-1debian7
...

gem install: Failed to build gem native extension (can't find header files)

I am using Fedora 14 and I have MySQL and MySQL server 5.1.42 installed and running.
Now I tried to do this as root user:
gem install mysql
But I get this error:
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
What's wrong here? In installed ruby 1.8.7. and the latest rubygems 1.3.7.
For those who may be confused by the accepted answer, as I was, you also need to have the ruby headers installed [ruby-devel].
The article that saved my hide is here.
And this is the revised solution (note that I'm on Fedora 13):
yum -y install gcc mysql-devel ruby-devel rubygems
gem install -y mysql -- --with-mysql-config=/usr/bin/mysql_config
For Debian, and other distributions using Debian style packaging the ruby development headers are installed by:
sudo apt-get install ruby-dev
For Ubuntu the ruby development headers are installed by:
sudo apt-get install ruby-all-dev
If you are using a earlier version of ruby (such as 2.2), then you will need to run:
sudo apt-get install ruby2.2-dev
(where 2.2 is your desired Ruby version)
Red Hat, Fedora:
yum -y install gcc mysql-devel ruby-devel rubygems
gem install -y mysql -- --with-mysql-config=/usr/bin/mysql_config
Debian, Ubuntu:
apt-get install libmysqlclient-dev ruby-dev
gem install mysql
Arch Linux:
pacman -S libmariadbclient
gem install mysql
For anyone reading this in 2015: if you happened to install the package ruby2.0, you need to install the matching ruby2.0-dev to get the appropriate Ruby headers. The same goes for ruby2.1 and ruby2.2, etc. For example:
$ sudo apt-get install ruby2.2-dev
it seems that the
yum install ruby-devel
was enough for me to perform
gem install datamapper
afterwards.
It's possible that you will need to install another packages:
yum install gcc gcc-c++
to be able to build native extensions
MAC users may face this issue when xcode tools are not installed properly.
Below is the command to get rid of the issue.
xcode-select --install
I found the solution here.
# yum install mysql-devel gcc make
# gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
This post helped me. Thanks a lot.
On Linux (Ubuntu 12.10) I needed to run
sudo apt-get install ruby
sudo apt-get install rubygems
sudo apt-get install ruby-dev
before I could succesfully run
sudo gem install jekyll
If you have gem installed and ruby and not able to install rails, then install ruby dev lib.
sudo apt-get install ruby-dev
It works for me. I have tried the different solution.
Red Hat, Fedora:
sudo dnf -y install gcc-c++ redhat-rpm-config ruby-devel gcc mysql-devel rubygems
For those that are still experiencing problems, like I have(I am using Ubuntu 16.04), I had to put in the following commands in order to get some gems like bcrypt, pg, and others installed. They are all similar to the ones above except for one.
sudo apt-get install ruby-dev -y
sudo apt-get install libpq-dev -y
sudo apt-get install libmysqlclient-dev
sudo apt-get install build-essential patch -y
This allowed me to install gems like, PG, bcrypt, and recaptcha.
My initial solution was to resolve the above errors by installing ruby-devel, patch and rubygems.
My issue was a bit different as bcrypt 3.1.11 still had issues compiling and installing on Fedora 23. I needed additional packages. So after ensuring I had the above installed, I was still having issues:
gcc: error: conftest.c: No such file or directory
gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
From here I had to do the following:
I ensured that I wasn't lacking any C compiler tools sudo dnf group install "C Development Tools and Libraries"
Then I ran sudo dnf install redhat-rpm-config to resolve the gcc issue listed above.
You can find a write up here on Fedore Project. You may also find answers to other needs as well.
sudo apt-get install ruby-dev
This command solved the problem for me!
You need following packages instaled:
ruby-dev
gcc
libffi-dev
make
Here's the command for debian distro:
sudo apt install gcc ruby-dev rubygems libgmp-dev libgmp3-dev make
in openSUSE:
zypper in ruby-devel
Works to me :)
It's necessary to install redhat-rpm-config to. I guess it solve your problem!
This worked for me:
yum -y install gcc mysql-devel ruby-devel rubygems
You might have messed up with the RVM.
Try to do:
\curl -sSL https://get.rvm.io | bash -s stable --rails
Just to add path to ruby.h file in my PATH
for example:
export PATH=$PATH:/usr/src/ruby-xxxxxx