简体   繁体   English

将现有的cakephp 3.0数据库迁移到mysql的postgres

[英]Migrating existing cakephp 3.0 database to postgres from mysql

I am in the process of migrating a cakephp 3.0 database from mysql to postgress. 我正在将cakephp 3.0数据库从mysql迁移到postgress。 I used this tool for the database migration and it worked beautifully. 我使用这个工具进行数据库迁移,它运行得很漂亮。 After that I changed the config file as shown below. 之后我更改了配置文件,如下所示。

  'default' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Postgres',
            'persistent' => false,
            'host' => 'localhost',
            'port' => '5432',
            'username' => 'postgres',
            'password' => 'mypass',
            'database' => 'cake_bookmarks',
            'encoding' => 'utf8',
            'timezone' => 'UTC',
            'cacheMetadata' => true,
            'log' => false,
            'quoteIdentifiers' => false,

            //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
        ],

The root folder in localhost also shows "successfully connected to database". localhost中的根文件夹还显示“已成功连接到数据库”。 However when i run my application, it shows an error: 但是,当我运行我的应用程序时,它显示一个错误:

Cannot describe mytable . 无法描述mytable It has 0 columns. 它有0列。 Cake\\Database\\Exception 蛋糕\\数据库\\异常

I can't make sure if this is because of not connecting to the database (which i think is unlikely as the root page shows as connected) or cakephp being unable to use my database. 我不能确定这是因为没有连接到数据库(我认为不太可能,因为根页显示为连接)或cakephp无法使用我的数据库。 If so, how can I fix the issue. 如果是这样,我该如何解决问题。 I am quite new to cakephp too, just confguring and doing basic stuff. 我对cakephp也很陌生,只是简单地做一些基本的事情。

Try the following (test after each step): 尝试以下(每个步骤后测试):

  • Check if the table is present in the database 检查数据库中是否存在该表
  • Check if the expected columns are defined into the table 检查是否在表中定义了预期的列
  • Clear the Cake cache (if is FileCache is enough to delete files under tmp/cache/persistent tmp/cache/models and tmp/cache/views 清除Cake缓存(如果FileCache足以删除tmp/cache/persistent tmp/cache/modelstmp/cache/views
  • Check the permissions of the specific user on the database cake_bookmarks (maybe via phppgadmin) 检查数据库cake_bookmarks上特定用户的权限(可能通过phppgadmin)

Hope to help! 希望能帮到你!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM