Work with MySQL database

Discussion in 'Ruby' started by Manny 777, Feb 19, 2011.

  1. Manny 777

    Manny 777 Guest

    Hi there,
    I'm new in RoR and I would like to ask you for help, how to check if
    the MySQL database works. I installed MySQL database with gem following:

    sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
    --with-mysql-dir=/usr/local/mysql
    --with-mysql-lib=/usr/local/mysql/lib \
    --with-mysql-include=/usr/local/mysql/include

    And everything went ok, no error or warning message.

    But now - I don't know, how to fast check that the MySQL database is
    installed ok - exist any command to terminal for this? Or any tutorial,
    how to check it?

    For PHP exist for manage of MySQL database PHPMyAdmin - exist something
    similar for Ror? I found rbDB, but it looks that the project is death...

    Thank you a lot for your time. :)
    [I'm working with terminal in Mac OS x]

    --
    Posted via http://www.ruby-forum.com/.
     
    Manny 777, Feb 19, 2011
    #1
    1. Advertising

  2. [Note: parts of this message were removed to make it a legal post.]

    On Sat, Feb 19, 2011 at 5:12 AM, Manny 777 <> wrote:

    > Hi there,
    > I'm new in RoR and I would like to ask you for help, how to check if
    > the MySQL database works. I installed MySQL database with gem following:
    >
    > sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
    > --with-mysql-dir=/usr/local/mysql
    > --with-mysql-lib=/usr/local/mysql/lib \
    > --with-mysql-include=/usr/local/mysql/include
    >
    > And everything went ok, no error or warning message.
    >
    > But now - I don't know, how to fast check that the MySQL database is
    > installed ok - exist any command to terminal for this? Or any tutorial,
    > how to check it?
    >
    > For PHP exist for manage of MySQL database PHPMyAdmin - exist something
    > similar for Ror? I found rbDB, but it looks that the project is death...
    >
    > Thank you a lot for your time. :)
    > [I'm working with terminal in Mac OS x]
    >
    > what you are asking is actually 3 questions.


    If you are on a mac, then just use sequel pro to admin mysql.
    As for using mysql with ruby, mysql2 gem is better than mysql gem.
    Read the documentation on mysql2 gem.

    Andrew McElroy

    > --
    > Posted via http://www.ruby-forum.com/.
    >
    >
     
    andrew mcelroy, Feb 19, 2011
    #2
    1. Advertising

  3. Manny 777

    Chris Kottom Guest

    [Note: parts of this message were removed to make it a legal post.]

    Previous respondent is right about mysql2 gem. To get a yes/no answer about
    whether the setup is valid and works with Rails, I would do it like this.

    # assuming you've got Rails 3 installed
    sudo gem install mysql2
    rails new test_app -d mysql
    cd test_app
    ruby -i.bak -pe 'gsub(/password:/, "password: <MYSQL ROOT PASSWORD>")'
    config/database.yml
    rake db:create
    rails dbconsole

    Enter your MYSQL ROOT PASSWORD string when prompted, and if you get a mysql
    prompt, you're good.

    There's probably a way to do this in fewer keystrokes, but this will
    definitely tell you whether you're OK within a minute or so.

    On Sat, Feb 19, 2011 at 3:27 PM, andrew mcelroy <> wrote:

    > On Sat, Feb 19, 2011 at 5:12 AM, Manny 777 <> wrote:
    >
    > > Hi there,
    > > I'm new in RoR and I would like to ask you for help, how to check if
    > > the MySQL database works. I installed MySQL database with gem following:
    > >
    > > sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
    > > --with-mysql-dir=/usr/local/mysql
    > > --with-mysql-lib=/usr/local/mysql/lib \
    > > --with-mysql-include=/usr/local/mysql/include
    > >
    > > And everything went ok, no error or warning message.
    > >
    > > But now - I don't know, how to fast check that the MySQL database is
    > > installed ok - exist any command to terminal for this? Or any tutorial,
    > > how to check it?
    > >
    > > For PHP exist for manage of MySQL database PHPMyAdmin - exist something
    > > similar for Ror? I found rbDB, but it looks that the project is death...
    > >
    > > Thank you a lot for your time. :)
    > > [I'm working with terminal in Mac OS x]
    > >
    > > what you are asking is actually 3 questions.

    >
    > If you are on a mac, then just use sequel pro to admin mysql.
    > As for using mysql with ruby, mysql2 gem is better than mysql gem.
    > Read the documentation on mysql2 gem.
    >
    > Andrew McElroy
    >
    > > --
    > > Posted via http://www.ruby-forum.com/.
    > >
    > >

    >
     
    Chris Kottom, Feb 19, 2011
    #3
  4. Manny 777

    Greg Willits Guest

    Manny 777 wrote in post #982624:
    > But now - I don't know, how to fast check that the MySQL database is
    > installed ok - exist any command to terminal for this? Or any tutorial,
    > how to check it?
    >
    > For PHP exist for manage of MySQL database PHPMyAdmin - exist something
    > similar for Ror? I found rbDB, but it looks that the project is death...



    For GUI management of MySQL I use Querious (www.araelium.com)

    but for a quick test via Ruby GEM, I use the following little ruby test
    file:

    #!/usr/bin/env ruby

    require 'mysql'

    db_name = "mysql"
    sql = Mysql.new("127.0.0.1", "root", "", "#{db_name}")
    tables = sql.query("show tables from #{db_name}")

    table_names = []
    tables.each do |table_specs|
    table_names << table_specs[0]
    end

    p table_names

    -- gw

    --
    Posted via http://www.ruby-forum.com/.
     
    Greg Willits, Feb 20, 2011
    #4
  5. Manny 777

    Manny 777 Guest

    Hi guys,
    thanks a lot for your replies. I tried to install mysql2, but I get
    this messages:


    Building native extensions. This could take a while...
    Successfully installed mysql2-0.2.6
    1 gem installed
    Installing ri documentation for mysql2-0.2.6...

    Enclosing class/module 'mMysql2' for class Client not known

    Enclosing class/module 'mMysql2' for class Result not known
    Installing RDoc documentation for mysql2-0.2.6...

    Enclosing class/module 'mMysql2' for class Client not known

    Enclosing class/module 'mMysql2' for class Result not known


    Google said me about "Enclosing class... ", that I must need theh
    command, which posted Frederic
    (http://stackoverflow.com/questions/...-mysql2-using-rvm-ruby-1-9-2-p0-on-osx-10-6-5
    - second post)

    But if I try that command, I am getting this error:

    install_name_tool: can't open file:
    /Users/manny/.rvm/gems/ruby-1.9.2-p0/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
    (No such file or directory)


    How to continue with configuration Ror and Mysql now? It's like a
    enchanted ring - the problem rotate other problem...

    PS: Querious looks fine!

    --
    Posted via http://www.ruby-forum.com/.
     
    Manny 777, Feb 20, 2011
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JL
    Replies:
    0
    Views:
    1,149
  2. Ravi
    Replies:
    6
    Views:
    1,411
    Suchandra Thapa
    Jul 21, 2003
  3. Replies:
    2
    Views:
    6,198
  4. washakie
    Replies:
    4
    Views:
    925
    washakie
    Jan 15, 2008
  5. julian
    Replies:
    8
    Views:
    451
    Avatar
    Apr 6, 2006
Loading...

Share This Page