Firebird 数据库 SYSDBA 连接错误
Firebird database SYSDBA connection error
我刚刚安装了适用于 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.
最奇怪的是,如果我导航到员工数据库示例本身并从那里发出 isql 命令,我就可以成功连接。
不同的是,直接连接数据库文件不需要密码,甚至会忽略密码,只需要使用提供的用户就知道申请哪些权限。
如果没有主机名,ISQL 将默认使用 Firebird 嵌入式模式,而不是服务器。要比较,请尝试使用 isql employee.fdb
(或 isql employee
),它将仅使用您当前的 OS 用户名登录,而 isql localhost:employee
将失败并显示 'Your user name and password are not defined'。
您指定的密码似乎与默认的 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.
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.
In a suitable shell, start an isql interactive session, opening the employee database via its alias:
> isql -user sysdba employee
Create the SYSDBA user:
SQL> create user SYSDBA password 'SomethingCryptic';
SQL> commit;
SQL> quit;
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;
如果出现错误 "record not found for user: SYSDBA",请确保您确实以 SYSDBA 身份连接,否则重试最初的第 3 步。没有管理员访问权限将表现得像用户不存在,所以如果用户真的不存在,或者你连接的是非特权用户,错误是一样的。
CONNECT 'employee' 用户 'SYSDBA' 密码 'masterkey';
你需要确保你的 alias.conf 有这样的东西:employee=C:/examplepath/employee.fdb
确保firebird服务开启
我刚刚安装了适用于 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.
最奇怪的是,如果我导航到员工数据库示例本身并从那里发出 isql 命令,我就可以成功连接。
不同的是,直接连接数据库文件不需要密码,甚至会忽略密码,只需要使用提供的用户就知道申请哪些权限。
如果没有主机名,ISQL 将默认使用 Firebird 嵌入式模式,而不是服务器。要比较,请尝试使用 isql employee.fdb
(或 isql employee
),它将仅使用您当前的 OS 用户名登录,而 isql localhost:employee
将失败并显示 'Your user name and password are not defined'。
您指定的密码似乎与默认的 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 indatabases.conf
, it is convenient to use it for the user management task.
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.
In a suitable shell, start an isql interactive session, opening the employee database via its alias:
> isql -user sysdba employee
Create the SYSDBA user:
SQL> create user SYSDBA password 'SomethingCryptic'; SQL> commit; SQL> quit;
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;
如果出现错误 "record not found for user: SYSDBA",请确保您确实以 SYSDBA 身份连接,否则重试最初的第 3 步。没有管理员访问权限将表现得像用户不存在,所以如果用户真的不存在,或者你连接的是非特权用户,错误是一样的。
CONNECT 'employee' 用户 'SYSDBA' 密码 'masterkey';
你需要确保你的 alias.conf 有这样的东西:employee=C:/examplepath/employee.fdb 确保firebird服务开启