Saturday, December 31, 2011

Re: Cake is NOT able to connect to the database.

I had the same problem when start using cake 2.0.4 on my work, but I tried it on my pc and it work fine.

It might be something with your server configuration.

I will doble check it on monday on my work.
Any news I tell you.

But you can try it on other server, or try to upgrade your mysql, or something like that.

--
Renato Freire




2012/1/1 Ronghua <ronghuazhao@gmail.com>
Yes, I grant all privileges to the user. Actually, if I write a php
file to connect to mysql directly, I can query the result from table.

<?php
$host='localhost';
$user_name='testuser';
$password='123456'; //这里****是你设置的密码

$conn=mysql_connect($host,$user_name,$password);
if (!$conn)
{
die('connect fail:'.mysql_error());
}
echo 'connect success!<br/>';
mysql_select_db("cake_testing", $conn);
$result = mysql_query("SELECT * FROM test");
while($row = mysql_fetch_array($result))
{
echo $row['ref']." ".$row['content'];
echo "<br />";
}
if (mysql_close($conn))
{
echo '<br/>...<br/>';
echo '到数据库的连接已经成功关闭';
}
?>

On 1月1日, 上午10时39分, 清水�己 <hiromi2...@gmail.com> wrote:
> Did you have done GRANT it?
>
> 2012/1/1 Ronghua <ronghuaz...@gmail.com>:
>
>
>
>
>
>
>
> > I also tried my root login configuration, but it doesn't work as well.
>
> > On 1月1日, 上午1时51分, "Timothy O'Reilly" <timothy.john.orei...@gmail.com>
> > wrote:
> >> I'm sure you have tried it, but have you tried Login "Root" and Password
> >> "Root"?
> >> Regards,
> >> Tim
>
> >> On Sat, Dec 31, 2011 at 2:59 AM, Ronghua <ronghuaz...@gmail.com> wrote:
> >> > Hi, today is first day I'm using cake. I have setup CakePHP 2.0.4. In
> >> > \app\Config\database.php, the configuration is as below
> >> > <?php
>
> >> > class DATABASE_CONFIG {
> >> >        public $default = array(
> >> >            'datasource' => 'Database/Mysql',
> >> >            'persistent' => false,
> >> >            'host' => 'localhost',
> >> >            'login' => 'testuser',
> >> >            'password' => '123456',
> >> >            'database' => '',
> >> >            'prefix' => '',
> >> >            'encoding' => ''
> >> >        );
> >> > }
>
> >> > I can connect to mysql with MySQLQueryBrowser by testuser and pwd
> >> > 123456, but I can't connect to database through Cake. Here is the
> >> > description in the website. Can someone help me here? From the website
> >> > reference, seems nothing else need to change.
>
> >> > Your version of PHP is 5.2.6 or higher.
>
> >> > Your tmp directory is writable.
>
> >> > The FileEngine is being used for caching. To change the config edit
> >> > APP/Config/core.php
>
> >> > Your database configuration file is present.
>
> >> > Cake is NOT able to connect to the database.
>
> >> > --
> >> > Our newest site for the community: CakePHP Video Tutorials
> >> >http://tv.cakephp.org
> >> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> >> > others with their CakePHP related questions.
>
> >> > To unsubscribe from this group, send email to
> >> > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> >> > athttp://groups.google.com/group/cake-php
>
> > --
> > Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: