简体   繁体   English

错误表“mysql.servers”不存在

[英]Error Table 'mysql.servers' doesn't exist

I get the error "Table 'mysql.servers' doesn't exist" from plesk when I try to create a new database user, the created user does not show up anywhere but the name is still reserved, and it does not allow me to access the database.当我尝试创建一个新的数据库用户时,我从 plesk 收到错误“表 'mysql.servers' 不存在”,创建的用户没有出现在任何地方,但名称仍然保留,它不允许我访问数据库。

edit: I was unable to login to phpMyAdmin to this webserver, so instead I managed to login to it through a different domain, and it tells me a notice: Your PHP MySQL library version 5.0.90 differs from your MySQL server version 5.1.49.编辑:我无法将 phpMyAdmin 登录到这个网络服务器,所以我设法通过不同的域登录它,它告诉我一个通知:您的 PHP MySQL 库版本 5.0.90 与您的 MySQL 服务器版本 5.1.49 不同. This may cause unpredictable behavior.这可能会导致不可预测的行为。

edit: manually installed phpmyadmin then manually installed libmcrypt (which is an accomplishment with my cruddy sever skills :D) so that phpmyadmin works.编辑:手动安装 phpmyadmin 然后手动安装 libmcrypt(这是我的 cruddy sever 技能的成就:D),以便 phpmyadmin 工作。 Then accidentally found out how to login as root via plesk (the trick is to enter webadmin without choosing any database), at least I think it's root :S ran the sql: GRANT SELECT ON mysql.* TO 'my-user'@'localhost';然后偶然发现了如何通过 plesk 以 root 身份登录(诀窍是在不选择任何数据库的情况下进入 webadmin),至少我认为它是 root :S 运行了 sql: GRANT SELECT ON mysql.* TO 'my-user'@'本地主机'; with a success message went back to plesk to see if I can manage the sql with "my-user" and no, its still missing from the available users, but the name is still reserved... tried to run: mysql_fix_privilege_tables –user=root –password=mypasswordobviosuly –verbose but gave and error, and i'm still not sure how to run direct mysql commmands without using ssh (because i dont know the root password)有一条成功消息返回plesk,看看我是否可以使用“my-user”管理sql,不,可用用户仍然缺少它,但名称仍然保留...尝试运行:mysql_fix_privilege_tables –user= root –password=mypasswordobviosuly –verbose 但给出了错误,我仍然不确定如何在不使用 ssh 的情况下直接运行 mysql 命令(因为我不知道 root 密码)

I entered mysql via pre-installed phpmyadmin as 'root' like so: (in plesk) home-> database servers -> webadmin.我通过预先安装的 phpmyadmin 以“root”身份进入 mysql,如下所示:(在 plesk 中)home-> 数据库服务器-> webadmin。 Then choose the "mysql" database, if the table 'servers' is missing (probably some mysql bug) then it will need to be created: choose 'SQL' in 'phpmyadmin' to and run the following sql:然后选择“mysql”数据库,如果缺少表“servers”(可能是一些mysql错误),则需要创建它:在“phpmyadmin”中选择“SQL”并运行以下sql:

CREATE TABLE `servers` (
`Server_name` char(64) NOT NULL,
`Host` char(64) NOT NULL,
`Db` char(64) NOT NULL,
`Username` char(64) NOT NULL,
`Password` char(64) NOT NULL,
`Port` int(4) DEFAULT NULL,
`Socket` char(64) DEFAULT NULL,
`Wrapper` char(64) NOT NULL,
`Owner` char(64) NOT NULL,
PRIMARY KEY (`Server_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='MySQL Foreign Servers table';

so that the table at least exists... then create a new user in plesk, and viola!这样表至少存在......然后在plesk和中提琴中创建一个新用户! it works!它有效! I was able to login as the user I created after that, it seems like it was some bug with some mysql update I did not even know about.我能够以我之后创建的用户身份登录,这似乎是一些我什至不知道的 mysql 更新的错误。

This error can sometimes appear after a new installation of MySQL when the mysql table does not get created properly.当 mysql 表未正确创建时,有时会在新安装 MySQL 后出现此错误。 Running the command...运行命令...

mysql_install_db --user=mysql

from the bash prompt (not the MySQL prompt) will install the table and get things working.从 bash 提示符(不是 MySQL 提示符)将安装该表并使其正常工作。

After running the command above on a new installation the following command will help secure the install...在新安装上运行上述命令后,以下命令将有助于保护安装...

mysql_secure_installation

This will prompt you to enter a root password, remove anonymous access, limit root access to localhost only and remove the test database.这将提示您输入 root 密码、删除匿名访问、将 root 访问限制为 localhost 并删除测试数据库。

These commands are for Linux, they may not work on Windows but there are corresponding commands if you search the MySQL docs.这些命令适用于 Linux,它们可能不适用于 Windows,但如果您搜索 MySQL 文档,则有相应的命令。

This is not related to the Plesk issue of the original poster but I stumbled upon this question while researching a MySQL installation problem and thought this might help save someone some time.这与原始海报的 Plesk 问题无关,但我在研究 MySQL 安装问题时偶然发现了这个问题,并认为这可能有助于节省一些时间。

Found the following when attempting to upgrade.尝试升级时发现以下内容。 Was directed to the following page: http://kb.parallels.com/en/112290被定向到以下页面: http : //kb.parallels.com/en/112290

I ran the following from that page:我从该页面运行以下内容:

"Run the following command for repairing MySQL table: "运行以下命令修复 MySQL 表:
#mysql_upgrade -T --debug-check -u admin -p`cat /etc/psa/.psa.shadow` mysql" #mysql_upgrade -T --debug-check -u admin -p`cat /etc/psa/.psa.shadow` mysql"

It looks like your user does not have access to the mysql database.看起来您的用户无权访问mysql数据库。 You may want to grant the SELECT command as follows:您可能希望按如下方式授予SELECT命令:

GRANT SELECT ON mysql.* TO 'your-user'@'localhost';

In my case show tables in mysql database identifies servers table exists, but yet I got the Error Table 'mysql.servers' doesn't exist error.在我的情况下, mysql数据库中的show tables标识servers表存在,但我得到了Error Table 'mysql.servers' doesn't exist错误。

Listing <data-dir>/mysql directory revealed servers.frm file exists, but relative servers.MYI and servers.MYD files were missing - maybe I played a role on that!列出<data-dir>/mysql目录显示servers.frm文件存在,但相关的servers.MYIservers.MYD文件丢失 - 也许我在这方面发挥了作用!

Anyhow knowing that I'm using the server as an intermediate server in a Daisy Chain Replication , I got a backup from servers.frm file and recreated the table by running the @timo-huovinen's answer things got back to normal.无论如何,知道我将服务器用作Daisy Chain Replication的中间服务器,我从servers.frm文件获得了备份,并通过运行@timo-huovinen 的回答重新创建了表,一切恢复正常。

It's noteworthy that there was at least one other table ( plugin ) missing MYI and MYD files.值得注意的是,至少有一个其他表( plugin )缺少MYIMYD文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM