# Select statements do not work on MySQL

**URL:** <https://www.ruby-forum.com/t/select-statements-do-not-work-on-mysql/177260>\
**Category:** Rails\
**Created:** [October 14, 2009, 8:57am UTC](https://www.ruby-forum.com/t/select-statements-do-not-work-on-mysql/177260 "2009-10-14T08:57:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![adammontgomery](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@adammontgomery](https://www.ruby-forum.com/u/adammontgomery)\
**Post date:** [October 14, 2009, 8:57am UTC](https://www.ruby-forum.com/t/select-statements-do-not-work-on-mysql/177260/1 "2009-10-14T08:57:08Z")

</div>

Hi everyone,

I run into a problem after deploying my app to prod env on a Apache  
server with Passenger and MySQL5.

The application works nearly fine, the only problem is that any select  
statements do not work on the database. For example if a user registers  
the app creates a new user entity in the user table. So creating  
entities does work good. But if I do a “User.find(1)” I get a nil back.  
And this happens at the complete app. Any find methtod (Select  
Statement) does work.

Do anybody has an idea?  
I thought it is the encoding and I switched the mysql db and the app to  
UTF8 but it didn’t help.

Thanks in advance.

Regards

Adam

---

<div class="post-metadata">

**Author:** ![adammontgomery](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@adammontgomery](https://www.ruby-forum.com/u/adammontgomery)\
**Post date:** [October 14, 2009, 9:01am UTC](https://www.ruby-forum.com/t/select-statements-do-not-work-on-mysql/177260/2 "2009-10-14T09:01:24Z")

</div>

Perhaps you should look up at the database user priviledges that you  
have.  
Thanks & Regards,  
Dhruva S…

Marie von  
Ebner-Eschenbach[http://www.brainyquote.com/quotes/authors/m/marie\_von\_ebnereschenbac.html](http://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac.html)

- “Even a stopped clock is right twice a day.”

On Wed, Oct 14, 2009 at 12:27 PM, Adam M. \<

---

<div class="post-metadata">

**Author:** ![adammontgomery](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@adammontgomery](https://www.ruby-forum.com/u/adammontgomery)\
**Post date:** [October 14, 2009, 9:16am UTC](https://www.ruby-forum.com/t/select-statements-do-not-work-on-mysql/177260/3 "2009-10-14T09:16:36Z")

</div>

Dhruva S. wrote:

> Perhaps you should look up at the database user priviledges that you  
> have.  
> Thanks & Regards,  
> Dhruva S…
> 
> Marie von  
> Ebner-Eschenbach[http://www.brainyquote.com/quotes/authors/m/marie\_von\_ebnereschenbac.html](http://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac.html)
> 
> - “Even a stopped clock is right twice a day.”
> 
> On Wed, Oct 14, 2009 at 12:27 PM, Adam M. \<

Hey Dhruva,

thanks for your reply. But it does not help.  
I used this HowTo to configure it.

[http://wiki.rubyonrails.org/database-support/mysql](http://wiki.rubyonrails.org/database-support/mysql)

Even if I insert the root account information for the MySQL into the  
database.yml it does not work.

☹

---

<div class="post-metadata">

**Author:** ![adammontgomery](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@adammontgomery](https://www.ruby-forum.com/u/adammontgomery)\
**Post date:** [October 14, 2009, 9:23am UTC](https://www.ruby-forum.com/t/select-statements-do-not-work-on-mysql/177260/4 "2009-10-14T09:23:39Z")

</div>

No, what I meant was to check for the permissions of the database user  
from  
the database configurations.Not from rails side. From mysql there might  
be  
some configuration errors, some missing grant’s or something, if you  
can’t  
directly access those permission settings from some cpanel or something  
then  
you might need to contact your hosting support.

This doesn’t seem to be a problem from rails side in my knowledge.

Thanks & Regards,  
Dhruva S…

## Mike Ditka [http://www.brainyquote.com/quotes/authors/m/mike\_ditka.html](http://www.brainyquote.com/quotes/authors/m/mike_ditka.html)

“If God had wanted man to play soccer, he wouldn’t have given us arms.”

On Wed, Oct 14, 2009 at 12:46 PM, Adam M. \<

---

<div class="post-metadata">

**Author:** ![adammontgomery](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@adammontgomery](https://www.ruby-forum.com/u/adammontgomery)\
**Post date:** [October 14, 2009, 10:04am UTC](https://www.ruby-forum.com/t/select-statements-do-not-work-on-mysql/177260/5 "2009-10-14T10:04:02Z")

</div>

On Wed, Oct 14, 2009 at 12:28 AM, Adam M. \<  
removed\_email\_address@domain.invalid\> wrote:

> > you might need to contact your hosting support.
> 
> Obviously with my specific parts.  
> It’s really unbelivable.

What happens when you attempt to access the database via the MySQL  
client  
program? For example

mysql -u your-non-root-user -p your-non-root-password  
your\_database\_development

After connecting, try doing something like the following:

select \* from

-Conrad

---

<div class="post-metadata">

**Author:** ![adammontgomery](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@adammontgomery](https://www.ruby-forum.com/u/adammontgomery)\
**Post date:** [October 14, 2009, 9:28am UTC](https://www.ruby-forum.com/t/select-statements-do-not-work-on-mysql/177260/6 "2009-10-14T09:28:28Z")

</div>

Dhruva S. wrote:

> No, what I meant was to check for the permissions of the database user  
> from  
> the database configurations.Not from rails side. From mysql there might  
> be  
> some configuration errors, some missing grant’s or something, if you  
> can’t  
> directly access those permission settings from some cpanel or something  
> then  
> you might need to contact your hosting support.
> 
> This doesn’t seem to be a problem from rails side in my knowledge.
> 
> Thanks & Regards,  
> Dhruva S…
> 
> ## Mike Ditka [http://www.brainyquote.com/quotes/authors/m/mike\_ditka.html](http://www.brainyquote.com/quotes/authors/m/mike_ditka.html)
> 
> “If God had wanted man to play soccer, he wouldn’t have given us arms.”
> 
> On Wed, Oct 14, 2009 at 12:46 PM, Adam M. \<

Yes, I know. I installed and configured the Production Server on my own.  
I set the grantt’s as it is shown in this HowTo:

CREATE DATABASE your\_database\_development;  
$ GRANT ALL PRIVILEGES ON your\_database\_development.\* TO  
‘your-non-root-user’@‘localhost’ IDENTIFIED BY  
‘your-non-root-password’;

Obviously with my specific parts.  
It’s really unbelivable.

---

<div class="post-metadata">

**Author:** ![adammontgomery](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@adammontgomery](https://www.ruby-forum.com/u/adammontgomery)\
**Post date:** [October 14, 2009, 10:23am UTC](https://www.ruby-forum.com/t/select-statements-do-not-work-on-mysql/177260/7 "2009-10-14T10:23:55Z")

</div>

Conrad T. wrote:

> On Wed, Oct 14, 2009 at 12:28 AM, Adam M. \<  
> removed\_email\_address@domain.invalid\> wrote:
> 
> > > you might need to contact your hosting support.
> > 
> > Obviously with my specific parts.  
> > It’s really unbelivable.
> 
> What happens when you attempt to access the database via the MySQL  
> client  
> program? For example
> 
> mysql -u your-non-root-user -p your-non-root-password  
> your\_database\_development
> 
> After connecting, try doing something like the following:
> 
> select \* from
> 
> -Conrad

Hey Conrad, I am at work now. Check it out when at home and come back to  
you.  
Cheers
