douhuitan5863
2017-09-04 11:19
浏览 64
已采纳

使用doctrine创建的数据库,未在phpmyadmin中显示

I am following the tutorial for Doctrine: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/getting-started.html

I changed the bootstrap file to include my database to:

<?php
// bootstrap.php
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;

require_once "vendor/autoload.php";

// Create a simple "default" Doctrine ORM configuration for Annotations
$isDevMode = false;
$paths = array(__DIR__."/src");
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
// or if you prefer yaml or XML
//$config = Setup::createXMLMetadataConfiguration(array(__DIR__."/config/xml"), $isDevMode);
//$config = Setup::createYAMLMetadataConfiguration(array(__DIR__."/config/yaml"), $isDevMode);

// database configuration parameters
$conn = array(
    'host' => '*********',
      'port' => '3306',
      'user' => '********',
      'password' => '****',
      'dbname' => 'bugs',
      'charset' => 'UTF8',
    'driver' => 'pdo_sqlite',
    'path' => __DIR__ . '/db.sqlite',
);

// obtaining the entity manager
$entityManager = EntityManager::create($conn, $config);

Then, I did the rest and create the tables, etc using the following commnad:

vendor/bin/doctrine orm:schema-tool:create 

Later, I logged to my 'myphpadmin' and the database was not there. Am I missing any step? Thank you

图片转代码服务由CSDN问答提供 功能建议

我正在关注Doctrine教程: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/ getting-started.html

我更改了引导程序文件以将我的数据库包括在:

 &lt;?php \  n // bootstrap.php 
use Doctrine \ ORM \ Tools \ Setup; 
use Doctrine \ ORM \ EntityManager; 
 
require_once“vendor / autoload.php”; 
 
 //创建一个简单的“默认”Doctrine ORM  Annotations的配置
 $ isDevMode = false; 
 $ paths = array(__ DIR __。“/ src”); 
 $ config = Setup :: createAnnotationMetadataConfiguration($ paths,$ isDevMode); 
 //或者如果您愿意 yaml或XML 
 // $ config = Setup :: createXMLMetadataConfiguration(array(__ DIR __。“/ config / xml”),$ isDevMode); 
 // $ config = Setup :: createYAMLMetadataConfiguration(array(__ DIR __。“/ config)  / yaml“),$ isDevMode); 
 
 //数据库配置par  ameters 
 $ conn = array(
'host'=&gt;  '*********',
'port'=&gt;  '3306',
'用户'=&gt;  '********',
'密码'=&gt;  '****',
'dbname'=&gt;  'bugs',
'charset'=&gt;  'UTF8',
'driver'=&gt;  'pdo_sqlite',
'path'=&gt;  __DIR__。  '/db.sqlite',
);
n获取实体管理器
 $ entityManager = EntityManager :: create($ conn,$ config); 
   
  
 

然后,我使用以下commnad完成剩下的工作并创建表等:

  vendor / bin / doctrine orm:schema-tool:create 
    
 
 

后来,我登录了我的'myphpadmin'并且数据库不在那里。 我错过了任何一步吗? 谢谢你

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douhe2305 2017-09-04 11:24
    已采纳

    That is because you are using the driver pdo_sqlite. It is creating an SQLite database and not a MySQL database. It should have created the file db.sqlite.

    Change it to pdo_mysql to get the database to show up in phpmyadmin.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题