Setup_database error

Hi,

I’m having an installation problem with Radiant.

I’m on a shared hosting at a university.

I succesfully installed ruby-1.8.5,

since I’m on a shared and can’t write on the /usr/ direcotry I used
–prefix=/home/cybrary/source/ruby

and then set up alias ruby=/home/cybrary/source/ruby/bin.ruby on my
.bashrc

Then I installed rubygems-0.9.0 using ruby setup.rb

And set up the gem alias.

Finally I typed /gem install radiant --include dependencies, set up the
radiant alias, and typed radiant mysite

It succesfully created my new site.

This is my database.yml

I was only assigned two databases by the university ‘test’ and ‘cybrary’
but I guess this shouldn’t be a problem.

development:
host: localhost
socket: /var/lib/mysql/mysql.sock
adapter: mysql
database:
username: p0pnfresh
password: xxx

test:
host: localhost
socket: /var/lib/mysql/mysql.sock
adapter: mysql
database: test
username: p0pnfresh
password: xxx

production:
host: localhost
socket: /var/lib/mysql/mysql.sock
adapter: mysql
database: cybrary
username: p0pnfresh
password: xxx


When I cd radiant and ruby script/setup_database test I get the
following
error:

Loading test environment…OK

WARNING! This script will overwrite information currently stored in the
database “test”. Are you sure you want to continue? [Yn] Y

Creating tables…
– drop_table(“config”)
– create_table(“config”, {:force=>true})
FAILED
/home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract_adapter.rb:120:in
log': Mysql::Error: Lost connection to MySQL server during query: CREATE TABLE config (idint(11) DEFAULT NULL auto_increment PRIMARY KEY,keyvarchar(40) DEFAULT '' NOT NULL,valuevarchar(255) DEFAULT '') ENGINE=InnoDB (ActiveRecord::StatementInvalid) from /home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_adapter.rb:184:inexecute’
from
/home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:104:in
create_table' from /home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_adapter.rb:297:increate_table’
from
/home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:273:in
send' from /home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:273:inmethod_missing’
from
/home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:257:in
say_with_time' from /home/cybrary/source/ruby/lib/ruby/1.8/benchmark.rb:293:inmeasure’
from
/home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:257:in
say_with_time' ... 6 levels... from script/setup_database:99:increate_tables’
from script/setup_database:19:in run' from script/setup_database:9:inrun’
from script/setup_database:297


On Oct 5, 2006, at 12:28 PM, [email protected] wrote:

Hi,

I’m having an installation problem with Radiant.

key
varchar(40) DEFAULT ‘’ NOT NULL, value varchar(255) DEFAULT ‘’)
ENGINE=InnoDB (ActiveRecord::StatementInvalid)

^^^^^ Last line is your problem, ActiveRecord::StatementInvalid. I
think it means that the database didnt understand the command that
rails sent to it.

Could you give us some more info about your system? What version of
mysql are you running? And what ruby-mysql adapter? I think I
remember reading that one of the ruby-mysql adapters is broken, but I
only have experience with Postgresql and SQLite.

Bodhi

Hi,

In response to Bodhi.

Im running mysql Ver 14.7 Distrib 4.1.20, for redhat-linux-gnu (i686)
using readline 4.3.

I viewed the file
/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_recor
d/connection_adapters/mysql_adapter.rb but I didn’t see the version.

How can I get its version?

I’ve installed Ruby 1.8.5, Gems 0.9.0, Rails 1.1.6, and Radiant 0.5.2

Jose.

Jose,

I had a similar problem a few days ago. I found out that some
connection problem with the database are due to the Ruby MySQL
bindings.

Maybe you can get an answer for your problem here:
http://wiki.rubyonrails.com/rails/pages/Mysql+Connection+Problems

  • Carlos

2006/10/5, [email protected] [email protected]:

On Oct 5, 2006, at 12:28 PM, [email protected] wrote:

FAILED
^^^^^ Last line is your problem, ActiveRecord::StatementInvalid. I
Radiant mailing list

Carlos David González Abraham
www.gonzalez-abraham.com.mx

Carlos,

Thanks for the info. I had already read that post elsewhere but It
wasn’t
so detailed as the one you sent me. I’ll be trying that out today on
Fedora 3. I have a doubt though.

What do the following lines mean?

– --with-mysql-include=/usr/include/mysql
–with-mysql-lib=/usr/lib/mysql

If they mean I’l be writing to that /usr/ directory It won’t work
because
I’m on a shared host and lack root access.

I feel like a total noob.

Jose.

Sorry for the spam. But my question would be, how can I know mysql’s
installation directory so to correctly set the gem install with mysql
prefix.

?

Jose.

On Oct 6, 2006, at 4:10 AM, [email protected] wrote:

  1. Cancel installation
    If you are on Fedora, try number 2 (1 is for Microsoft Windows).

to find out the MySQL directories, you could try (this might not work
on 4.1, I only tested on 5):

 bodhi@turbine-01$ mysql_config --include --libs
 -I/usr/local/include/mysql
 -L/usr/local/lib/mysql -lmysqlclient -lz -lcrypt -lm

after -I is the path for --with-mysql-include
after -L is for --with-mysql-lib (ignore the -lmysqlclient etc)

Bodhi

I tried gem install mysql – --with-mysql-include=/usr/include/mysql
–with-mysql-lib=/usr/lib/mysql

Whis is supposed to work on Fedora 3.

Select which gem to install for your platform (i686-linux)

  1. mysql 2.7.1 (mswin32)
  2. mysql 2.7 (ruby)
  3. mysql 2.6 (ruby)
  4. mysql 2.5.1 (ruby)
  5. Cancel installation

1
Successfully installed mysql-2.7.1-mswin32
Installing ri documentation for mysql-2.7.1-mswin32…
Installing RDoc documentation for mysql-2.7.1-mswin32…
While generating documentation for mysql-2.7.1-mswin32
… MESSAGE: Unhandled special: Special: type=17, text=""
… RDOC args: --op
/home/cybrary/source/ruby/lib/ruby/gems/1.8/doc/mysql-2.7.1-mswin32/rdoc
–exclude ext --main README --quiet ext README
docs/README.html(continuing
with the rest of the installation)

Now, when I -bash-3.00$ ruby script/setup_database
Run setup_database --help for information on additional options.

Loading development environment…OK

WARNING! This script will overwrite information currently stored in
thedatabase “Cybrary_dev”. Are you sure you want to continue? [Yn] Y

Creating tables…
– drop_table(“config”)
– create_table(“config”, {:force=>true})
FAILED
/home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract_adapter.rb:120:in
log': Mysql::Error: Lostconnection to MySQL server during query: CREATE TABLE config (idint(11) DEFAULT NULL auto_increment PRIMARY KEY,keyvarchar(40) DEFAULT '' NOT NULL,valuevarchar(255) DEFAULT '') ENGINE=InnoDB (ActiveRecord::StatementInvalid) from /home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_adapter.rb:184:inexecute’ from
/home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:104:in
create_table' from /home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_adapter.rb:297:increate_table’ from
/home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:273:in
send' from /home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:273:inmethod_missing’
from
/home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:257:in
say_with_time' from /home/cybrary/source/ruby/lib/ruby/1.8/benchmark.rb:293:inmeasure’
from
/home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:257:in
say_with_time' ... 6 levels... from script/setup_database:99:increate_tables’
from script/setup_database:19:in run' from script/setup_database:9:inrun’
from script/setup_database:297

Error!!

If I choose 2,

2
Building native extensions. This could take a while…
/home/cybrary/source/ruby/lib/ruby/1.8/fileutils.rb:243: command not
found: ruby extconf.rb install mysql –
–with-mysql-include=/usr/include/mysql --with-mysql-lib=/usr/lib/mysql

ERROR: While executing gem … (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in
/home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/mysql-2.7 for
inspection.

Results logged to
/home/cybrary/source/ruby/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out

Doesn’t even install. I’ve no clue.

jose.

Thenks Bohdi!

I got Radiant installed succesfully after struggling with the mysql gem.
I
followed http://www.rubyforums.com/showthread.php?t=132

Thanks!

Hi,

Now I’m having a similar problem with the mysql gem on a different
server.
When I /gem install mysql and choose 2 there is an error.

2
Building native extensions. This could take a while…
/usr/local/ruby/lib/ruby/1.8/fileutils.rb:243: command not found: ruby
extconf.rb install mysql
ERROR: While executing gem … (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in
/usr/local/ruby/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
ruby extconf.rb install mysql\n

Results logged to
/usr/local/ruby/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out

Then, when I try to reconfigure /mysql-2.7/extconf.rb

[flmm][/usr/local/ruby/lib/ruby/gems/1.8/gems/mysql-2.7]$ ruby
extconf.rb
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
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… yes
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.

I know I’ve to use configuration options but feel totally lost again.

Jose : (

If I ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config
like I did before to make it work I get

ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config
checking for mysql_ssl_set()… no
checking for mysql.h… no
checking for mysql/mysql.h… no
*** extconf.rb failed ***

It looks I’m missing some files. I’ve seen the mysql.h in
/usr/local/mysql/include

but haven’t seen the mysql_ssl_set

jose.

Sorry for the spam : (

But I solved the problem. I was pointing to the wrong place to look for
the libraries.

It wasn’t /usr/bin but /usr/local/mysql/bin/

Sorry for the spam again next time I’ll wait a couple of days of
persistent errors before writing.

Jose.