PDOException SQLSTATE [HY000]未知的数据库'伪造'失败 [英] PDOException SQLSTATE[HY000] [1049] Unknown database 'forge' failed

查看:3630
本文介绍了PDOException SQLSTATE [HY000]未知的数据库'伪造'失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想访问一个Mysql数据,第一步是为vanvlymen创建一个新表,我键入mysql> USE vanvlymen;数据库更改。并键入SHOW表;显示数据库包含的表的可用性。

I want to access a Mysql data the first step is to create a new table for "vanvlymen" and I typed mysql> USE vanvlymen; the database changed. and type SHOW tables; showing the available of the tables that the database contains.

mysql -u root -p 
enter password: ****

mysql> show databases;
-databases-

 information_schema
 mysql
 performance_schema
 phpmyadmin
 vanvlymen

 5 rows...

一切都看起来不错...
我决定告诉mysql指定数据库我在执行查询之前是vanvlymen

everything is looking good... I have decide to tell mysql to specify the database I am working on before executing the query as "vanvlymen"

app / config / database.php

app/config/database.php

   'mysql' => array(
        'driver'    => 'mysql',
        'host'      => 'localhost',
        'database'  => 'vanvlymen',
        'username'  => 'foobar',
        'password'  => 'foobar',
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
    ),

另存为文件转到FileZilla使用FTP查找文件拖放到我的活动服务器覆盖database.php文件。

save as file go to FileZilla using FTP find a file drag and drop into my live server overwrite the database.php file.

我已尝试清除缓存

 php artisan cache:clear 

 php artisan migrate

it错误:

 SQLSTATE[42000] [1049] unknown database 'forge'. 

为什么保持它不知道数据库'forge'我除了改变到vanvlymen数据库。我应该删除mysql并重新安装?

Why keeping it said unknown database 'forge' I am excepting to change to vanvlymen database. Should I remove mysql and reinstall?

我使用windows 8.1与laravel 4.2

I am using windows 8.1 with laravel 4.2

使用phpmyadmin,我知道什么是密码和用户名登录。

Using phpmyadmin, I know what is the password and username to log in.

推荐答案

你有类似app / config / yourEnvironment /database.php?
例如 local 生产。 'forge'是这个配置文件中DB的默认名称,所以看起来你的应用程序加载了错误的配置文件。

Do you have something like app/config/yourEnvironment/database.php ? For example local or production. 'forge' is default name of DB in this config file, so it looks like your app is loading wrong config file.

这篇关于PDOException SQLSTATE [HY000]未知的数据库'伪造'失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆