on my Centos Machine, i had to install mysql-devel.x86_64 first, then i
ran the command:
env ARCHFLAGS=“-arch x86_64” gem install mysql –
–with-mysql-config=/usr/lib64/mysql/mysql_config
which did the trick.
thanks Kyle
I use Centos , but it’s i386 . So I installd mysql-devel,and use the
command:
env ARCHFLAGS=“-arch i386” gem install mysql –
–with-mysql-config=/usr/lib/msyql/mysql_config",
and it did the work , Aha!
Best is to install macports, if you aren’t already using it.
To re-compile ruby, run:
sudo port install ruby
I was able to get mysql gem to install on OSX Leopard without warnings
with the --no-rdoc and --no-ri switches; archflags likewise eliminated
the uninitialized constant error:
sudo gem install mysql --no-rdoc --no-ri –
–with-mysql-config=/usr/local/mysql/bin/mysql_config
That hasn’t made my installation functional however. I just rebuilt my
entire project with rails myApp -d mysql; I then scaffolded 5 sets of
tables (i.e. script/generate scaffold tablename c_code:string
c_name:string tran_id:integer priority:integer); I next drag the project
directory onto XCode Organizer; create the start server script
(script/server); and start the gem server in terminal: gem server.
Fine and dandy so far (seemingly). Then I run rake db:migrate to
engender the following error:
database.yml indicates that this is supposed to be the development
database. But no such file exists in my project directory.
What file would you expect? This refers to a database, physical
location dependent on your MySQL configuration.
Is this a MySQL server configuration issue? Does anybody understand why
this table is not being created?
Perhaps you left out the step where you create it? At least I didn’t see
it in your post. You can create databases manually through the MySQL
CLI console or a number of other tools, or you can run the appropriate
rake task. rake -T will give you a list of the available tasks.
But you do have to create it before running your migrations
I am not sure of why this error is coming, but just for a moment, try
rake
db:create before doing rake db:migrate.
It might solve your problem.
The Mysql::Result constant is defined in the mysql_api gem (.so shared
object) - this is located in
gems/1.9.1/gems/mysql-2.8.1/ext/mysql_api/mysql_api.so
To fix the error the cleanest way I could think of - I created a
symbolic link to this object in /usr/lib/ruby/1.9.1/ - which is in
Ruby’s $LOAD_PATH variable - which you can see your own version via :
irb; puts “#{$LOAD_PATH}”;
None of the solutions people had posted on the web helped me - the
main ones I kept seeing were - reinstall the mysql gem with ARCH_FLAGS
set differently - and make a symbolic link mysql -> ‘.’ because Ruby was
looking one directory too deep
I’m using Ubuntu Karamic Koala, Ruby 1.9.1, mysql-2.8.1, rails-2.3.5
After all attempts. I simply uninstall mysql 5.5.9 (64 bits) and all
mysql gems.
Then install Mysql 5.1.55 (64 bits) and
“sudo env ARCHFLAGS=”-arch x86_64" gem install mysql – --with-mysql-
config=/usr/local/mysql/bin/mysql_config"
and it works on MAC…
Hope it helps.
Matthew Werner wrote in post #982105:
Hi All,
This has been the most thorough discussion of the topic I’ve found. I’ve
spent far too much time trying to get this stupid gem to work. I’m going
to post the information i’ve got and I’m praying someone out there will
be able to help me.
ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
mysql --version
mysql Ver 14.14 Distrib 5.5.9, for osx10.6 (i386) using readline 5.1
rails -v
Rails 2.3.5
sudo gem uninstall mysql
Successfully uninstalled mysql-2.8.1
Here is where I’ve seen so so (SO) many different recommendations on
what to do. I’ve tried damn near everything, both sudo and not,
specifying my arch flags and not. I’ll just go with the most thorough:
export ARCHFLAGS="-arch i386" ; sudo gem install --no-rdoc --no-ri mysql –
–with-mysql-dir=/usr/local
–with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions. This could take a while…
Successfully installed mysql-2.8.1
1 gem installed
I’m lost on what else it could be. I feel like I’ve tried every
combination. I’ve tried reinstalling ruby, 64bit of mysql, please help.
I’m out of ideas.