yii2接入pgSQL(查詢不到表The table does not exist: {{%user}})
yii2框架接入pgSQL(查詢不到表The table does not exist: {{%user}})
我是yii2的框架做的系統接的是MySQL資料庫,後面因為其他情況又要去接pgSQL,導致遇到上面的情況,我的情況是我的pgSQL資料庫下有賬號的表兩個,我用的是第一個賬號下的表,但系統獲取的是第二個public賬號下的表,導致系統執行要查詢表的時候就會報錯The table does not exist: {{%user}}.
解決辦法:
在yii2專案中的config/db.php中加入以下程式碼
<?php
return [
'class' => 'yii\db\Connection',
'dsn' => 'pgsql:host=192.168.01.01;port=5432;dbname=test',
'username' => 'test',
'password' => '123456',
'tablePrefix' => 'ts_', //表字首
'schemaMap' => [
'pgsql'=> [
'class'=>'yii\db\pgsql\Schema',
'defaultSchema' => 'public' //指定系統接pgSQL資料庫下哪個賬號的表
]
],
];
相關文章
- SNMP TABLE ERROR : Requested table is empty or does not existError
- ORA-00942: table or view does not existView
- PL/SQL: ORA-00942: table or view does not existSQLView
- The user specified as a definer ('wx_root'@'%') does not exist 解決方案
- pgsql查詢優化之模糊查詢SQL優化
- mysql 1449 : The user specified as a definer ('root'@'%') does not exist 解決方法MySql
- asmcmd does not exist in directoryASM
- imp 時出現在ORA-00942: table or view does not existView
- IMP 時的 ORA-01435 user does not exist 處理
- job呼叫過程報錯 ORA-00942: table or view does not existView
- from v * ERROR at line 1: ORA-00942: table or view does not existErrorView
- javax.media does not existJava
- impala查詢不到hive裡建立的表Hive
- pgsql 執行建庫指令碼時候出現ERROR: relation "xxx_id_seq" does not existSQL指令碼Error
- MIRO Error:Table T169V: entry G180 does not existError
- 【問題】 table 和column 查詢表定義
- [BUG反饋]子查詢報錯,Base table or view not found: 1146 Table 'onethink.(' doesn't existView
- dcat-admin 表單 Field type [autocomplete] does not exist.
- MIGO Error:Check table 169P: entry G180 does not existGoError
- 啟動OEM時關於ora-00942:table or view does not exist的處理View
- Property [title] does not exist on this collection instance
- Waring: /dev/centos/swap does not existdevCentOS
- PatchObject constructor:Input file does not existObjectStruct
- 安裝kernel...src.rpm錯誤:warning: user mockbuild does not exist - using rootMockUI
- 查詢使用表空間的TABLE,INDEX,INDEX SUBPARTITIONIndex
- 用user_tab_modifications查詢表dml操作時間
- exist-in和關聯子查詢-非關聯子查詢
- GoldenGate 執行ddl_setup.sql出錯 ORA-00942: table or view does not existGoSQLView
- PSQLexception: ERROR : type "signed" does not existSQLExceptionError
- Laravel Class env does not exist 問題排查Laravel
- FAQ:Field DATABASE does not exist; see long textDatabase
- Check table 169P: entry XXXX does not exist的解決
- sqlserver查詢table,columns資訊SQLServer
- yii2 資料庫常見查詢資料庫
- Yii2聯合查詢(配合GridView)View
- yii2 查詢資料庫語法資料庫
- MyBatis-maven-User例子-根據id查詢UserMyBatisMaven
- audit by user by table