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

使用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

  • 写回答

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Jenkins+k8s部署slave节点offline
  • ¥15 微信小游戏反编译后,出现找不到分包的情况
  • ¥15 如何实现从tello无人机上获取实时传输的视频流,然后将获取的视频通过yolov5进行检测
  • ¥15 WPF使用Canvas绘制矢量图问题
  • ¥15 用三极管设计一个单管共射放大电路
  • ¥15 孟德尔随机化r语言运行问题
  • ¥15 pyinstaller编译的时候出现No module named 'imp'
  • ¥15 nirs_kit中打码怎么看(打码文件是csv格式)
  • ¥15 怎么把多于硬盘空间放到根目录下
  • ¥15 Matlab问题解答有两个问题