diff --git "a/content/zh/post/zhangcuiping/\344\270\272\344\273\200\344\271\210\346\227\240\346\263\225\345\210\207\346\215\242\345\210\260\347\233\256\346\240\207\346\225\260\346\215\256\345\272\223.md" "b/content/zh/post/zhangcuiping/\344\270\272\344\273\200\344\271\210\346\227\240\346\263\225\345\210\207\346\215\242\345\210\260\347\233\256\346\240\207\346\225\260\346\215\256\345\272\223.md" new file mode 100644 index 0000000000000000000000000000000000000000..e02c011ba5c1ab2597aa86157c348fe9cdd70240 --- /dev/null +++ "b/content/zh/post/zhangcuiping/\344\270\272\344\273\200\344\271\210\346\227\240\346\263\225\345\210\207\346\215\242\345\210\260\347\233\256\346\240\207\346\225\260\346\215\256\345\272\223.md" @@ -0,0 +1,55 @@ +title = "为什么无法切换到目标数据库" + +date = "2022-07-14" + +tags = ["为什么无法切换到目标数据库"] + +archives = "2022-07" + +author = "张翠娉" + +summary = "为什么无法切换到目标数据库" + +img = "/zh/post/zhangcuiping/title/img.png" + +times = "14:20" + ++++ + +# 为什么无法切换到目标数据库? + +**背景介绍**: + +在执行数据库相关操作时,发现无法切换到目标数据库。 + +**报错内容**: + +```bash +[ommdoc@hostname]$ gsql -d postgres -p 28000 +gsql ((MogDB 3.0.0 build 62408a0f) compiled at 2022-06-30 15:06:56 commit 0 last mr ) +Non-SSL connection (SSL connection is recommended when requiring high-security) +Type "help" for help. + +MogDB=# \c mogdb +Non-SSL connection (SSL connection is recommended when requiring high-security) +You are now connected to database "mogdb" as user "ommdoc". +mogdb=# \c MogDB +Non-SSL connection (SSL connection is recommended when requiring high-security) +You are now connected to database "mogdb" as user "ommdoc". +mogdb=# +``` + +**报错原因**: + +初始化库名时,只是把原来初始化的postgres库名,在客户端gsql上替换成了MogDB而已。实际上在数据库系统表和内部,其实是postgres库。 + +**解决办法**: + +执行以下命令进行切换: + +```bash +mogdb=# \c postgres +Non-SSL connection (SSL connection is recommended when requiring high-security) +You are now connected to database "postgres" as user "ommdoc". +MogDB=# +``` \ No newline at end of file