gpt4 book ai didi

database - Firebird 数据库 SYSDBA 连接错误

转载 作者:搜寻专家 更新时间:2023-10-30 22:07:10 31 4
gpt4 key购买 nike

我刚刚安装了适用于 Win64 的 Firebird,我正在尝试连接到预先打包在 ISQL 中的员工数据库。
按照Firebird官方的步骤 QuickStart 文档我打开 ISQL 实用程序并输入:

connect localhost:employee user sysdba password masterkey;

结果我得到了:

Statement failed, SQLSTATE = 28000
Your user name and password are not defined. Ask your database administrator to set up a Firebird login.

screenshot of IQSL utility

最奇怪的是,如果我导航到员工数据库示例本身并从那里发出 isql 命令,我就可以成功连接。 screenshot of Windows Command Prompt

最佳答案

不同的是,直接连接到数据库文件不需要密码,它甚至会忽略密码,只使​​用提供的用户来知道应用哪些权限。

如果没有主机名,ISQL 将默认使用 Firebird 嵌入式模式,而不是服务器。为了比较,尝试使用 isql employee.fdb(或 isql employee),它只会使用您当前的操作系统用户名登录,而 isql localhost:employee 将失败并显示“您的用户名和密码未定义”。

看起来您指定的密码与默认的 masterkey 不同,或者 sysdba 帐户未初始化。我记得早期 Firebird 3 版本的安装程序存在问题,但我认为 3.0.2 不会受此影响(或者至少:它对我有用)。

如果 SYSDBA 帐户未初始化,请按照 Firebird 3 发行说明中 Initializing the Security Database 部分的步骤进行操作:

Initialization Steps

Initialization is performed in embedded mode using the isql utility. For an embedded connection, an authentication password is not required and will be ignored if you provide one. An embedded connection will work fine with no login credentials and “log you in” using your host credentials if you omit a user name. However, even though the user name is not subject to authentication, creating or modifying anything in the existing security database requires that the user be SYSDBA; otherwise, isql will throw a privilege error for the CREATE USER request.

The SQL user management commands will work with any open database. Because the sample database employee.fdb is present in your installation and already aliased in databases.conf, it is convenient to use it for the user management task.

  1. Stop the Firebird server. Firebird 3 caches connections to the security database aggressively. The presence of server connections may prevent isql from establishing an embedded connection.

  2. In a suitable shell, start an isql interactive session, opening the employee database via its alias:

    > isql -user sysdba employee
  3. Create the SYSDBA user:

    SQL> create user SYSDBA password 'SomethingCryptic';
    SQL> commit;
    SQL> quit;
  4. To complete the initialization, start the Firebird server again. Now you will be able to perform a network login to databases, including the security database, using the password you assigned to SYSDBA.

“SomethingCryptic”应该是您的密码。

如果创建了 SYSDBA 用户,如果您不再记得自己设置的密码,则需要更改其密码。遵循相同的步骤,但在第 3 步中执行:

SQL> alter user SYSDBA set password '<new password>';
SQL> commit;
SQL> quit;

如果出现错误“未找到用户的记录:SYSDBA”,请确保您确实以 SYSDBA 身份连接,否则重试最初的第 3 步。没有管理员访问权限的行为就像用户不存在,因此如果用户确实不存在,或者如果您连接的是非特权用户,则错误是相同的。

关于database - Firebird 数据库 SYSDBA 连接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48041137/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com