I want to gem install do_mysql, it fails because the MySQL header files can not be found.
do_mysql.c:5:19: error: mysql.h: No such file or directory
do_mysql.c:6:20: error: errmsg.h: No such file or directory
do_mysql.c:7:26: error: mysqld_error.h: No such file or directory"
My system adminstrator install mysql as a package, so basically the "/usr/local/mysql" do not exist at all!!
So what should I do?
by querying the package
rpm -q --filesbypkg mysql-5.5.19-1.el6.remi.x86_64
mysql /usr/bin/msql2mysql
mysql /usr/bin/mysql
mysql /usr/bin/mysql_config
mysql /usr/bin/mysql_find_rows
mysql /usr/bin/mysql_waitpid
mysql /usr/bin/mysqlaccess
mysql /usr/bin/mysqladmin
[...]
You have to install the "developer package" of MySQL on your distribution which contains the required header files (your error message contains pointers at mysql.h).
On RHEL 6 or compatible distribution you can just install the package mysql-devel.
Related
I am on FreeBSD 10.2 32 bit and installed the newest version of mysql with the following command:
pkg install mysql57-server-5.7.12
Now, when I try to start mysql:
service mysql-server start
/usr/local/etc/rc.d/mysql-server: WARNING: failed precmd routine for mysql
I am getting this error. I hope you can help me.
Check your /var/db/mysql folder, if it contains files, make a backup and delete dir content:
rm -rf /var/db/mysql/*
Then do a data directory initialization:
/usr/local/libexec/mysqld --initialize --user=mysql
You should get a new temporary password, write it down, then start mysql-server
service mysql-server start
After mysql starts, secure the installation via:
/usr/local/bin/mysql_secure_installation
Open /etc/rc.conf and append or modify this line :
mysql_enable="YES"
Save the file, close it and retry to start the server.
I'm trying to use Rails with the MySQL bin from Ampps, but when I run the command rails generate scaffold User name:string email:string I get the following error:
dyld: lazy symbol binding failed: Symbol not found: _mysql_server_init
Referenced from: /Users/myusername/.rvm/gems/ruby-2.2.1/gems/mysql2-0.4.2/lib/mysql2/mysql2.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_server_init
Referenced from: /Users/myusername/.rvm/gems/ruby-2.2.1/gems/mysql2-0.4.2/lib/mysql2/mysql2.bundle
Expected in: flat namespace
I have already configured Ampps Mysql with my environment but I can not managed to make it work with rails, I have the following configurations.
$ which mysql
/Applications/AMPPS/mysql/bin/mysql
$ echo $PATH
/Users/myusername/.rvm/gems/ruby-2.2.1/bin:/Users/myusername/.rvm/gems/ruby-2.2.1#global/bin:/Users/myusername/.rvm/rubies/ruby-2.2.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/myusername/.rvm/gems/ruby-2.2.1/bin:/Users/myusername/.rvm/gems/ruby-2.2.1#global/bin:/Users/myusername/.rvm/rubies/ruby-2.2.1/bin:/Applications/AMPPS/php-5.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/myusername/.rvm/bin:/Users/myusername/.rvm/bin:/Applications/AMPPS/mysql/bin
$ ls -l /usr/local/lib/libmy*.dylib
lrwxr-xr-x 1 myusername admin 53 Jan 1 19:30 /usr/local/lib/libmysqlclient.18.dylib -> /Applications/AMPPS/mysql/lib/libmysqlclient.18.dylib
I have tried doing commands but with no success:
$ gem install mysql2 -- --with-mysql-lib=/Applications/AMPPS/mysql/lib --with-mysql-include=/Applications/AMPPS/mysql/include --with-mysql-config=/Applications/AMPPS/mysql/bin/mysql_config
And
bundle config build.mysql2 --with-mysql-lib=/Applications/AMPPS/mysql/lib --with-mysql-include=/Applications/AMPPS/mysql/include --with-mysql-config=/Applications/AMPPS/mysql/bin/mysql_config
bundle install
Any ideas?
I downloaded this AMPPS package and did a quick check on the MySQL binary:
$ file /Volumes/AMPPS/AMPPS/mysql/bin/mysql
/Volumes/AMPPS/AMPPS/mysql/bin/mysql: Mach-O executable i386
Your 64-bit Ruby install is trying to link to 32-bit MySQL libraries, and is not finding what it's looking for. "Symbol not found" errors are often an indication of an architecture mismatch.
My advice to you would be to install these programs from a package management system such as MacPorts or Homebrew. I'm partial to MacPorts, so I'll give you instructions for that. I get the impression Homebrew is more popular, but haven't used it myself.
Install Xcode and the Xcode Command Line Tools
Agree to Xcode license in Terminal: sudo xcodebuild -license
Install MacPorts: https://distfiles.macports.org/MacPorts/MacPorts-2.3.4-10.11-ElCapitan.pkg
Update the port list: sudo port selfupdate
Install away: sudo port install mysql56 rb-rails rb-mysql
Update regularly: sudo port selfupdate && sudo port -uc upgrade outdated
This way you're getting properly built binaries for your system, you can easily keep them up to date, and you aren't filling your system up with 2 gigabytes of things you aren't necessarily going to use (5 different versions of PHP, a couple of database servers, Perl, Python, etc.) In addition, you also get up-to-date versions of other utilities like Ruby, rather than relying on the outdated version that ships with the operating system.
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
My previous install of MySQL on OS X was done manually with the native package installer.
Someone was helping me with an issue I had with upgrading some gems, and in process they installed mysql from the homebrew tools.
Since that point, I'm unable to access any of my local databases from MySQLWorkbench or from my various rails apps, but logging in with mysql on CLI using the same credentials allows me to read and write to all tables as normal.
The error I'm receiving from rails when I try to load a page is:
Mysql2::Error: Can't read dir of './r4/' (errno: 13): SHOW TABLES LIKE 'schema_migrations'
Any ideas as to what I can do to fix that?
Found the issue - permissions had changed on the /usr/local/mysql/data folder, I had to run:
cd /usr/local/mysql/data
sudo chown -R _mysql mysql*
* Note: Replace mysql* with the directory/directories causing the error. *
It´s really a hard job figuring out how to get MySQL and mysql gem up and running on Snow Leopard 10.6.2. I followed the instructions of various posts but was not successful yet:
I build MySQL Version 5.1.39 from source and it installed successfully. When trying to login using (mysql -u root -p) mysql returned the following error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
that obviously meant that the MySQL Server (mysqld) was not running.
which mysql: /usr/local/mysql/bin/mysql
which ruby: ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-darwin9])
gem -v: 1.3.5
mysql: Server version: 5.1.39 MySQL Community Server (GPL)
After a lot of googling around, I found out that
this command can start mysqld:
sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &
The Preference Pane MySQL Tool is probably broken in Mac OS X 10.5 and higher
This command should install the mysql gem correctly on Snow Leopard:
sudo gem uninstall mysql
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
It ended up that I got the following error using something like rake db:create:
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /opt/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_init
Referenced from: /opt/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
This error led me to the following post: http://cho.hapgoods.com/wordpress/?p=158, that basically tells me that the Ruby Version that came together with XCode 3.0 does not work in 64bit environments and a solution could be to install the 32bit versionof MySQL.
Any suggestions, how to proceed?
While building from source is not necessarily a bad idea, even if the official distribution is built using a better compiler, using MacPorts (http://www.macports.org/install.php) to do it is probably a better idea than a self-built installation.
Although you can wrangle the OS X supplied Ruby and MySQL into shape, in my experience it's easier to work entirely within the MacPorts realm (/opt) and leave your original distribution unmolested.
A further advantage is you get a more up-to-date Ruby executable. 10.6 ships with 1.8.7p72 where MacPorts provides 1.8.7p174, for instance.
Example:
sudo port install mysql5
sudo port install mysql5-server
sudo port install rb-mysql