AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / dba / 问题

问题[mac-os-x](dba)

Martin Hope
Troy
Asked: 2020-12-29 16:34:41 +0800 CST

postgres:找不到数据库系统

  • 0

如果我尝试运行该postgres命令,我会得到:

2020-12-29 00:14:53.213 GMT [34374] LOG:  skipping missing configuration file "/usr/local/pgsql/data/postgresql.auto.conf"
postgres: could not find the database system
Expected to find it in the directory "/usr/local/pgsql/data",
but could not open file "/usr/local/pgsql/data/global/pg_control": No such file or directory

如何找出告诉 postgres 查看 /usr/local/pgsql/data 的配置文件?

就我而言,postgres 是通过 Homebrew 安装在 OSX 上的。

postgresql mac-os-x
  • 1 个回答
  • 862 Views
Martin Hope
Freemium
Asked: 2020-08-26 09:07:50 +0800 CST

如何启动 PostgreSQL 12.4 [OSX]

  • 2

我不是来自 PostgreSQL 背景,我想将它用于我目前正在从事的项目,因为它是我正在使用的推荐数据库。

我使用 PgAdmin 4 来可视化数据库,我对该应用程序上“关闭服务器”的字面理解是它关闭了数据库,但事实并非如此。所以我想学习如何在项目开始时启动/停止/重新启动服务器,这样我就可以更好地在以后管理它。



tl;dr:在 OSX 上,不使用自制软件并使用默认设置/目录结构,启动 DB 的正确方法/命令是什么?


我的尝试和错误的开始......

在许多网站上大量阅读之后,我找到了停止服务器的方法,一种对我个人有用的方法——不使用 Homebrew 和 OSX

停止数据库

$ sudo -u postgres pg_ctl -D /Library/PostgreSQL/12/data/ stop

could not identify current directory: Permission denied
waiting for server to shut down.... done
server stopped

极好的!
数据库停止了。该网站无法正常工作,但除外。

正在尝试开始...

现在,自然地尝试重新启动它

$ sudo -u postgres pg_ctl -D /Library/PostgreSQL/12/data/ start

产量...

could not identify current directory: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
The program "postgres" is needed by pg_ctl but was not found in the
same directory as "pg_ctl".
Check your installation.

哦哦...

所以pg_ctl不在同一个目录中......也许我需要在命令中指定它的路径

$ sudo -u postgres /Library/PostgreSQL/12/bin/pg_ctl -D /Library/PostgreSQL/12/data/ start
could not identify current directory: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
The program "postgres" is needed by pg_ctl but was not found in the
same directory as "pg_ctl".
Check your installation.

尝试#1

尝试别的东西,省略-D因为我可能过于复杂的事情......

$ sudo -u postgres pg_ctl start
could not identify current directory: Permission denied
pg_ctl: no database directory specified and environment variable PGDATA unset

PGDATA没有设置...我在我的用户上设置了它,所以我猜它不是为postgres用户设置的。那就试试吧

$ sudo -u postgres export PGDATA="/Library/PostgreSQL/12/data/"
sudo: export: command not found

好吧,不是那样的。那么然后呢?!

进一步阅读,我看到一些使用initdb(归功于此 Q 中的最终更新),而不是start我想我会试一试。似乎没有其他任何工作,所以让我们尝试一下

$ sudo -u postgres /Library/PostgreSQL/12/bin/pg_ctl -D /Library/PostgreSQL/12/data/ initdb
could not identify current directory: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
The program "initdb" is needed by pg_ctl but was not found in the
same directory as "pg_ctl".
Check your installation.

尝试#2

也许重新排列命令一点点......

$ sudo su postgres pg_ctl initdb -D /Library/PostgreSQL/12/data/
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
/Library/PostgreSQL/12/bin/pg_ctl: /Library/PostgreSQL/12/bin/pg_ctl: cannot execute binary file

反复出现的主题,这一切是什么“无法访问目录”?我正在运行 sudo 和 postgres 用户,就像我读过的所有内容中的其他人一样!为什么它在我的情况下不起作用?...

尝试#3

$ ls -la /Library/PostgreSQL/12/data/
ls: : Permission denied

有道理...我记得以前尝试访问该 /data 目录,但仅限于 postgres 用户。
所以让我尝试做我迄今为止尝试过的事情并尝试ls作为 postgres

$ sudo -u postgres ls -la /Library/PostgreSQL/12/data/
total 112
[...]

这是什么疯子?!它有效,我可以访问,但我无法运行启动数据库所需的任何命令!sudo 可以访问所有内容;postgres 可以访问该目录...

尝试#4

让我们检查一些其他的东西。

sudo -u postgres which pg_ctl
/Library/PostgreSQL/12/bin/pg_ctl

所以 postgres 有pg_ctl,但不能运行它。

也许让我们尝试作为我的用户帐户,忘记 postgres 用户

$ pg_ctl initdb --pgdata=/Library/PostgreSQL/12/data/
The files belonging to this database system will be owned by user "Freemium".
**This user must also own the server process.**

The database cluster will be initialized with locale "en_GB.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

initdb: error: could not access directory "/Library/PostgreSQL/12/data": Permission denied
pg_ctl: database system initialization failed

所以它不能是我的用户帐户,我什至不想拥有该进程,这就是 postgres 用户的用途。

尝试#5

让我们尝试使用 root - 在这一点上,为什么不呢。

$ sudo pg_ctl initdb --pgdata=/Library/PostgreSQL/12/data/
pg_ctl: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.

不,即使是root也不想要它。在这两种情况下,它都暗示它必须是 postgres 用户。那么为什么 tf 不起作用???

尝试#6

此时我只是想知道如果我运行原始stop命令会发生什么

$ sudo -u postgres pg_ctl -D /Library/PostgreSQL/12/data/ stop
could not identify current directory: Permission denied

嗯...再次使用当前目录权限...

经过所有这些尝试,如何简单地start使用 PostgreSQL 服务器?



postgresql mac-os-x
  • 1 个回答
  • 1773 Views
Martin Hope
Jay
Asked: 2020-08-14 15:01:41 +0800 CST

使用 Sequel Ace 的非程序员,如何解决“Out of sort memory,考虑增加服务器排序缓冲区大小”错误?

  • 1

我不知道 MySQL,但我想浏览一下表中的一些数据。我将数据库导入 Sequel Ace (MacOS) 并且浏览表时没有问题,但是当尝试对较大表中的一列进行排序时,我收到“排序内存不足,请考虑增加服务器排序缓冲区大小”错误。

我该如何做到这一点?

我已经安装并运行了 MySQL。

mysql mac-os-x
  • 1 个回答
  • 264 Views
Martin Hope
Михаил Бабин
Asked: 2020-03-30 16:36:16 +0800 CST

PostgreSQL 在计数行查询期间崩溃

  • 0

目前我只有两张桌子——一张可以正常工作的小桌子,另一张可能很大。当我尝试在 pgAdmin 中找出行数时,出现以下错误:

The application has lost the database connection:
⁃ If the connection was idle it may have been forcibly disconnected.
⁃ The application server or database server may have been restarted.
⁃ The user session may have timed out.
Do you want to continue and establish a new session?

我还检查了 Postgres 服务器日志:

2020-03-30 03:06:06.764 MSK [37356] LOG:  server process (PID 30712) was terminated by signal 9: Killed: 9
2020-03-30 03:06:06.764 MSK [37356] DETAIL:  Failed process was running: SELECT COUNT(*)::text FROM ios.task_info;
2020-03-30 03:06:06.764 MSK [37356] LOG:  terminating any other active server processes
2020-03-30 03:06:06.765 MSK [30810] WARNING:  terminating connection because of crash of another server process
2020-03-30 03:06:06.765 MSK [30810] DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2020-03-30 03:06:06.765 MSK [30810] HINT:  In a moment you should be able to reconnect to the database and repeat your command.
2020-03-30 03:06:06.765 MSK [30709] WARNING:  terminating connection because of crash of another server process
2020-03-30 03:06:06.765 MSK [30709] DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2020-03-30 03:06:06.765 MSK [30709] HINT:  In a moment you should be able to reconnect to the database and repeat your command.
2020-03-30 03:06:06.767 MSK [37356] LOG:  all server processes terminated; reinitializing
2020-03-30 03:06:06.776 MSK [30816] LOG:  database system was interrupted; last known up at 2020-03-30 02:51:14 MSK
2020-03-30 03:06:06.818 MSK [30817] FATAL:  the database system is in recovery mode
2020-03-30 03:06:06.853 MSK [30816] LOG:  database system was not properly shut down; automatic recovery in progress
2020-03-30 03:06:06.855 MSK [30816] LOG:  redo starts at 0/4F4DE850
2020-03-30 03:06:06.855 MSK [30816] LOG:  invalid record length at 0/4F4DE888: wanted 24, got 0
2020-03-30 03:06:06.855 MSK [30816] LOG:  redo done at 0/4F4DE850
2020-03-30 03:06:06.862 MSK [37356] LOG:  database system is ready to accept connections

我在我的 OS X Catalina 笔记本电脑上运行所有东西并使用 PostgreSQL 12 EnterpriseDB。

以防万一它很重要 - 我创建了一个大表COPY,在我的 Python 脚本中发送了几个大型 CSV 查询。这些错误的原因是什么?

postgresql mac-os-x
  • 1 个回答
  • 812 Views
Martin Hope
Dycey
Asked: 2019-11-27 07:02:42 +0800 CST

运行 Postgres“createuser”命令的问题

  • -1

我正在尝试在createuserPostgres 11.6 的 MacOS 10.15 安装上运行该命令。我已启用root,但没有postgres用户可以su作为 - 有一个_postgres用户:

dd@finglas:~ $ cat /etc/passwd | grep 'post'
_postfix:*:27:27:Postfix Mail Server:/var/spool/postfix:/usr/bin/false
_postgres:*:216:216:PostgreSQL Server:/var/empty:/usr/bin/false

对$PATHPostgres 工具有效,并which createuser指向正确的二进制文件:

dd@finglas:~ $ which createuser
/Applications/Postgres.app/Contents/Versions/latest/bin/createuser

我期望能够执行以下操作:

dd@finglas:~ createuser dev_user

我可以以用户身份登录 Postgres 本身postgres,但我无法createuser从终端运行。有什么建议么?

postgresql mac-os-x
  • 1 个回答
  • 366 Views
Martin Hope
Edison
Asked: 2019-06-21 18:30:57 +0800 CST

(macOS/Docker)“无法批量加载。文件路径不存在或您没有文件访问权限。”

  • 0

我正在 macOS 上的 Docker 容器中运行 SQL Server。除了加载 csv 文件之外的所有查询都将被执行。列名等是正确的。有任何想法吗?

错误:

无法批量加载。文件“/Users/me/snp500-company-by-sector.csv”不存在或您没有文件访问权限。

bulk insert CompanyBySector
from '/Users/me/snp500-company-by-sector.csv'
with
(   
    firstrow = 2,
    fieldterminator = ';',
    rowterminator = '\n',
    tablock
)
go
sql-server mac-os-x
  • 1 个回答
  • 1812 Views
Martin Hope
Lee
Asked: 2018-08-15 04:50:05 +0800 CST

Homebrew MariaDB 服务器启动错误,带有“mysql.server start”

  • 4

在 MacOS 10.13.6 上启动 MariaDB 10.3.8 时,会出现以下奇怪行为:

mac:~user$ mysql.server start

Starting MariaDB

.180813 17:50:11 mysqld_safe Logging to '/usr/local/var/mysql/mbp.local.err'.

180813 17:50:11 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql.. ERROR!

ERROR 之前的输出中实际上还有很多点!被展示; 该过程需要几分钟。奇怪的是服务器确实运行。并且关机看起来很正常:

mac:~user$ mysql.server stop

Shutting down MariaDB.. SUCCESS!

知道如何确定是什么导致启动时出现错误消息并修复它吗?

mariadb mac-os-x
  • 2 个回答
  • 17039 Views
Martin Hope
Basil Bourque
Asked: 2018-04-15 12:51:49 +0800 CST

pgAdmin 4 版本 3 第二次打开失败

  • 38

我刚刚为macOS Sierra安装了pgAdmin 4版本 3.0.0 ,替换了与在同一台 Mac 上本地运行的Postgres 10.3捆绑的pgAdmin 。

我打开了pgAdmin 4.app应用程序图标,这导致Safari 浏览器出现在前面,并带有一个显示常用 pgAdmin 用户界面的选项卡。好的。

我在 Safari 中关闭了该选项卡。现在,当我打开pgAdmin 4.app图标(双击或选择File> Open)时,什么也没有发生。

pgAdmin 是否应该在浏览器窗口而不是应用程序自己的窗口中启动?

➡如何重新打开pgAdmin?

pgadmin mac-os-x
  • 3 个回答
  • 44353 Views
Martin Hope
CodeChimp
Asked: 2018-01-27 06:40:02 +0800 CST

是否可以只安装 mongo Shell?

  • 45

我已经安装了 Docker,并且正在MongoDB我的 Mac 上为我的本地开发运行一个容器。问题是我无法从 CLI 轻松连接到所述数据库。我安装了Robo 3T,但我更喜欢使用CLI客户端。

有没有一种已知的方法来安装mongo shell(command mongo) 而不是 OS X 上的完整 DB 发行版?

mongodb mac-os-x
  • 4 个回答
  • 38360 Views
Martin Hope
Basil Bourque
Asked: 2017-09-09 17:31:39 +0800 CST

在 macOS 上卸载 Postgres 10 – EnterpriseDB 安装程序

  • 7

标题说明了一切……如何从 macOS 计算机中完全删除 Postgres 集群?

作为对社区的礼貌,我使用了EnterpriseDB提供的安装程序应用程序。

这个卸载问题已经在 Stack Overflow 上被问过多次。但这些问题和答案已经过时多年了。

postgresql mac-os-x
  • 2 个回答
  • 10253 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve