14 Jun 2009, 23:29
Generic-user-small

Mike Varela (1 post)

Having a heck of a time getting my rails to talk with Mysql.

I’m using Rails 2.3.2 Ruby 1.8.7 Mysql 5.1.35

I’ve successfully installed all three. (note that your book doesn’t cover installation very well, not detailed enough, i.e. creating a src directory, working with PATH on mac)

Anyways, I can successfully create the database “newsletter” but when I type mysqlshow I don’t see the database. I think I might be using a database in another location, though when I query which mysql it looks right. below is my info


my path file (.profile)

export PATH=”/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH”


my database.yml file

development:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: newsletter_development
  pool: 5
  username: root
  password:
  socket: /tmp/mysql.sock

and some responses from terminal

Last login: Sun Jun 14 15:40:19 on ttys000
You have new mail.
VarelaMacbook:~ Mike$ which mysql
/usr/local/mysql/bin/mysql
VarelaMacbook:~ Mike$ mysqlshow
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| test               |
+--------------------+
VarelaMacbook:~ Mike$ cd newsletter
VarelaMacbook:newsletter Mike$ mysqladmin -u root -p create newsletter_development
Enter password: 
mysqladmin: CREATE DATABASE failed; error: 'Can't create database 'newsletter_development'; database exists'
VarelaMacbook:newsletter Mike$ mysqlshow
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| test               |
+--------------------+
VarelaMacbook:newsletter Mike$ 

So I’m stuck…. any help

15 Jun 2009, 00:08
Mike_pragsmall

Mike Naberezny (7 posts)

Hi,

I noticed that you did not give any connection information to the @mysqlshow@ command. You need to give it the same user and password arguments as you did for @mysqladmin@:

$ mysqladmin -u root -p create newsletter_development

The @mysqlshow@ command would then be:

$ mysqlshow -u root -p

</code>

Regards, Mike

  You must be logged in to comment