Installing mysql problem - mysql

Running OS X Leopard an MacBook Pro from Jan. 2008.
I used to run mysql server from a package but then rails started putting a warning that I should install mysql from gem: gem install mysql
It did not work, I got the following error message:
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
... snip ...
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.7/gem_make.out
Then I tried a different way, upon a friend's advice and tried to follow the excellent instructions at http://hivelogic.com/articles/2007/11/installing-mysql-on-mac-os-x
but now ran into a new problem when trying to run 'mysql -u root'
The message I get is:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
I have googled my heart out trying to fix either problem and feel stuck. Thanks for reading and helping

To the first problem - I would imagine that Ruby gem is installing the ruby MySQL interface/drivers, not the MySQL server itself. It may be not present, or in a place the standard scripts can't find.
The second message indicates that the MySQL server is not running. Try starting it again, or examine any logs/messages for some indication as to why it might not be starting

Related

Can't start mysql (Homebrew Mac M1)

I have a error when i try to run the MYSQL server
When i try to run with brew services start mysql, return me this error
brew services start mysgl
Bootstrao failed: 5: Inout/outout error
Try re-running the command as root for richer errors
Error: Failure while executina;
`/bin/launchetl bootstrap qui/501 /Users/<user>
/Library/LaunchAgents/homebrew.mxcl.mysql.plist`exited with 5
If i ran this with sudo don't work
%
sudo brew services start mysgl
Warning: Taking root:admin ownership of some mysql paths:
/opt/homebrew/Cellar/mysql/8.0.30_1/bin
/opt/homebrew/Cellar/mysq1/8.0.30_1/bin/mysqld_safe
/opt/homebrew/opt/mysql
/opt/homebrew/opt/mysql/bin
/opt/homebrew/var/homebrew/linked/mvsal
This will require manual removal of these paths using
sudo rm' on
brew upgrade/reinstall/uninstall.
Warning: mysql must be run as non-root to start at user login!
/Library/LaunchDaemons/homebrew.mxcl.mysql.plist:servic ealready bootstrapped
Bootstrap failed: 37: Operation already in progress
Error: Failure while executing: `/bin/launchctl bootstrap system /Library/LaunchDaemons/homebrew.mxcl.mysql.plist`exited with 37
<user>~ % brew services list
Name status User File
mysql stopped root ~/Librarv/LaunchAgents/homebrew.mxcl.mvsal.olist
I was try to unistall and install the HomeBrew and the MYSQL again but always had the same ¡s errors.
Thanks for the help.
Not a real answer:
If it is not absolutely required for you to run it as a native process, run it in docker.
Besides that: mysql wants to run as root, as the error message says. Maybe you need to correct the mode bits. Inspect the brew post installation steps carefully, usually there is a hing or command to execute.

redmine installation fail ubuntu 14.04

I got error while installing redmine on ubuntu 14.04. I don't understand why I get this error.
Below is are stack I get
apt-get install redmine redmine-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
redmine is already the newest version.
redmine-mysql is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up redmine (2.4.2-1) ...
dbconfig-common: writing config to /etc/dbconfig-common/redmine/instances/defaul
t.conf
Creating config file /etc/redmine/default/database.yml.new with new version
granting access to database redmine_default for redmine_default#localhost: alrea
dy exists.
creating database redmine_default: already exists.
dbconfig-common: flushing administrative password
Replacing config file /etc/redmine/default/session.yml with new version
A new secret session key has been generated in /etc/redmine/default/session.yml
Populating database for redmine instance "default".
This may take a while.
rake aborted!
Server is running in --secure-auth mode, but 'redmine_default'#'localhost' has a
password in the old format; please change the password to the new format
/var/lib/gems/1.9.1/gems/mysql2-0.3.16/lib/mysql2/client.rb:70:in `connect'
/var/lib/gems/1.9.1/gems/mysql2-0.3.16/lib/mysql2/client.rb:70:in `initialize'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
Error when running rake db:migrate, check database configuration.
dpkg: error processing package redmine (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
redmine
E: Sub-process /usr/bin/dpkg returned an error code (1)
Errors were encountered while processing: redmine
E: Sub-process /usr/bin/dpkg returned an error code (1)`
Following is output of command dpkg -l redmine
`Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
iF redmine 2.4.2-1 all flexible project management web a`
Rails version install on my machine
rails -v
Rails 4.1.4
Ruby version install on my machine
ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
apache2 version
`apache2 -v
Server version: Apache/2.4.7 (Ubuntu)
Server built: Apr 3 2014 12:20:28`
I am new to ubuntu and also linux. Can anyone identify why I get this error ?
The problem is the way the password is being passed to the MySQL server.
You can set secure_auth: true in the database.yml file right under where the password is specified to use the appropriate format.
Alternatively, you could disable secure auth in the mysql daemon config and restart.

can't install mysql2 gem! Failed to build gem native extension

Been trying to install the mysql2 gem for couple of days, let me tell you where I am stuck and describe the steps I took.
The CMD command that throws an error is: gem install --http-proxy http://web1-proxy:8088 mysql2 !!
Error description:
Error installing mysql2:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
checking for ruby/thread.h... no
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
To begin from the start, I installed Ruby 1.9.3, then Rails 4.1.1.
How I installed Ruby:
From rubyinstaller.org (downloads) I took rubyinstaller-1.9.3-p448.exe
Checked "Add Ruby executables to your PATH" and "associate .rb and .rbw files with this ruby installation"
From the same page I installed the Dev Kit (DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe) in C:\RubyDevKit
I went to RubyDevKit in cmd and typed:
dir dk.rb
ruby dk.rb init
ruby dk.rb install
I launched irb (typed irb in C:\RubyDevKit) to confirm ruby works and it does.
How I installed rails:
Went to C:\Ruby193\bin from cmd and typed: gem install rails
this threw an error (established connection failed because connected host has failed to respond) which I fixed by going to Internet Options - Connections - LAN Settings - Out of the 4 options, I only checked the last 2 options: Use a proxy server for your LAN (address: web1-proxy, port number given to me by the IT)
After this I migrated from CMD to "c:\Sites" and typed: set HTTP_PROXY=http://web1-proxy:8088
Then: From CMD C:\Ruby193\bin> gem install --http-proxy http://web1-proxy:8088 rails
Then: C:\Sites> rails new app2
to confirm it works: C:\Sites\app2> rails server
Installation steps I followed for Mysql:
From http://dev.mysql.com/downloads/mysql/
(Note: MySQL Installer is 32 bit, but will install both 32 bit and 64 bit binaries.)
Picked the smaller package and RAN the file. During the installation:
Chose “developer default”
on the next page agreed to installing pre-requirements (MySql Server, .NET, Connectors etc).
Config Type = “Development Machine”; I checked: “Enable TCP/IP Networking”, Port number = 3306, checked: Open Firewall port for network access.
Set MySql root pwd; didn’t add user at this stage
Windows Service name: MySQL 55, Ran MySQL Server at System startup; Ran Win Service as: Standard System Account
Didn’t start MySql workbench after setup
The ODBC Connector 5.3.2 failed to install during the mysql installation, so afterwards I followed this workaround: http://dev.mysql.com/downloads/connector/ . Clicked on the "Connector/ODBC" link. Made sure "Select Platform" showed "Microsoft Windows". Clicked on the appropriate download button for MSI Installer. After downloading ran the .msi file.
How I debugged my problem so far:
Copied libmysql.dll from C:\Program Files\MySQL\MySQL Server 5.5\lib to C:\Ruby193\bin and tried again - no luck
Copied also the libmysql.lib file from C:\Program Files\MySQL\MySQL Server 5.5\lib to C:\Ruby193\bin and tried again - no luck
Tried gem install --HTTP-PROXY http://web1-proxy:8088 mysql2 --no-rdoc --no-ri -- '--with-mysql-lib="C:\Program Files\MySQL\MySQL Server 5.6\lib\" --with-mysql-include="C:\Program Files\MySQL\MySQL Server 5.6\include\"' - no luck
Tried all 3 of the above solutions with previous versions of mysql installed (using again the installer) and with previous ODBC Connectors.
Help!!

"gem install mysql2" on Mac with MAMP 2.2

When trying to run a rails server in my current directory (which is a new rails project), it says that I need to install the mysql2 gem. At first, I had no idea what this meant... Then, I did some poking around, and finally decided to install the gem. However, I am getting this super pesky error (seeing as I just spent 2 hours trying to investigate, and solve another error). I am on the brink of giving up, but I really want to try rails. Please help!
Currently, if I run sudo gem install mysql2, or even as some people told me to do online, gem install mysql -- \ --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config (I have MAMP), it gives me the following error:
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/vicky/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Using mysql_config at /Applications/MAMP/Library/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load
-----
-----
Setting libpath to /Applications/MAMP/Library/lib
-----
creating Makefile
make "DESTDIR="
compiling client.c
compiling mysql2_ext.c
compiling result.c
linking shared-object mysql2/mysql2.bundle
ld: warning: directory not found for option '-L/Users/mpapis/.sm/pkg/active/lib'
ld: library not found for -lmysqlclient
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1
Gem files will remain installed in /Users/username/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14 for inspection.
Results logged to /Users/username/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14/ext/mysql2/gem_make.out
Have you considered installing MySQL with homebrew (http://brew.sh/)? MAMP stands for Mac-Apache-MySQL-PHP (the last part of this being the most important). I would suggest just installing MySQL directly on your box (homebrew takes care of all the heavy lifting) and afterwards I doubt you'll have any difficulty installing that gem.
To install homebrew --
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Run brew doctor follow any instructions and then afterwards to install MySQL run brew install mysql and follow any of the instructions it provides for setting up a user, etc...
============= UPDATE ==============
SO, what you'll want to do is use brew this way to install MySQL and then install the gem in the normal fashion - sudo gem install mysql2 assuming this works, then you will be able to switch back to the old MySQL install through MAMP via -
sudo nano /etc/paths
then add this line to the top of the document -
/Applications/MAMP/Library/bin
restart your terminal and then run mysql to double check that you are using the MAMP installation of MySQL, and you'll be good to go.

Really weird error installing mysql2 gem with rails3 on mac

I get this error:
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
I've tried everything here but I still get the error. For some reason when I run locate mysql_config this is the result I get:
/Applications/MAMP/Library/bin/mysql_config
/Applications/MAMP/Library/share/man/man1/mysql_config.1
I tried running sudo gem install mysql2 -- –with-mysql config=/path/you/identified/above/mysql_config twice using each path but I still get the error from above. I downloaded a fresh version of MySql and I have Xcode, but I still get these errors. What am I doing wrong?
Is the MAMP install the only install of mysql you have? If you've installed it from the mysql package then I think mysql_config will be installed in /usr/local/bin/mysql_config, so you might want to try:
sudo gem install mysql2 -- –with-mysql-config==/usr/local/bin/mysql_config
FYI, the /Applications/MAMP/Library/share/man/man1/mysql_config.1 path is clearly wrong. That's pointing to the man file for mysql_config not the actual executable.
Just to be certain, you did try this right? (exactly as written)
sudo gem install mysql2 -- –with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
Also, I'm not sure that mysql packaged with MAMP has the header files you need. You might be best to install mysql from http://dev.mysql.com/downloads/mysql/ and then try to install your gem. In this case I think it will just work.