MySQL 安装过程中出现 phpmyadmin 错误“指定了‘端口’的空值。”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37089568/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 21:46:34  来源:igfitidea点击:

phpmyadmin error during installation "Empty value for 'port' specified."

mysqlapacheubuntuphpmyadmin

提问by alionthego

I have been trying to install phpmyadmin on my digitalocean droplet using ubuntu 14.04 / mysql 5.7.12 . I have a LAMP stack with apache as the web server.

我一直在尝试使用 ubuntu 14.04 / mysql 5.7.12 在我的 digitalocean droplet 上安装 phpmyadmin。我有一个使用 apache 作为 Web 服务器的 LAMP 堆栈。

During installation I keep getting the error shown here. error messageE

在安装过程中,我不断收到此处显示的错误。错误信息

I am pretty new to phpmyadmin and wondering why I keep getting this. Previously installing phpmyadmin with an older version of mysql was error free. I am trying to install it as a non-root sudo user.

我对 phpmyadmin 很陌生,想知道为什么我一直收到这个。以前使用旧版本的 mysql 安装 phpmyadmin 没有错误。我正在尝试将它安装为非 root sudo 用户。

Any direction or suggestions will be greatly appreciated.

任何方向或建议将不胜感激。

回答by William Ardila

My machine configuration - Ubuntu 16.04 - MySql 5.7.13 - PHP 7.0.8 - Apache 2.4.18

我的机器配置 - Ubuntu 16.04 - MySql 5.7.13 - PHP 7.0.8 - Apache 2.4.18

Edit the file /etc/dbconfig-common/phpmyadmin.conf, changing

编辑文件/etc/dbconfig-common/phpmyadmin.conf,更改

dbc_dbport=''to dbc_dbport='0'

dbc_dbport=''dbc_dbport='0'

After editing the file and saving it, if you are still on the dbconfig-common wizard select retry; if not run sudo dpkg-reconfigure phpmyadmin(choose Yeswhen asked you if you want to Reinstall database for phpmyadmin) and continue normally without changing any value. If you want to change some value do it in the file that you have edited before.

编辑文件并保存后,如果您仍然在 dbconfig-common 向导中,请选择retry;如果不运行sudo dpkg-reconfigure phpmyadmin(在询问您是否要为 phpmyadmin 重新安装数据库时选择)并继续正常运行而不更改任何值。如果您想更改某个值,请在您之前编辑过的文件中进行更改。

When configuration window asks what you want to do with existing configuration file choose Keep the local version currently installed.

当配置窗口询问您要对现有配置文件做什么时,选择Keep the local version current installed

At this point you can check the differences and only those must exist that you made in the file.

在这一点上,您可以检查差异,只有那些必须存在于文件中的差异。

回答by Michal ?iha?

MySQL behavior has changed here, so you have few options:

MySQL 的行为在这里发生了变化,因此您有几个选择:

Update: You can workaround this bug as described in answer from William Ardila.

更新:您可以按照William Ardila 的回答中所述解决此错误。

回答by Michal ?iha?

I've searched the internet for hours but none worked for me except this.

我搜索了几个小时上网,但没有为我工作,除了这个

After changing dbc_dbport=''to dbc_dbport='0'I still encountered some other problems.

改变后dbc_dbport=''dbc_dbport='0'我还是遇到了一些其他问题。

If you are not able to continue the configuration process properly, follow these additional steps:

如果您无法正确继续配置过程,请执行以下附加步骤:

First, simply choose Abort.

首先,只需选择中止。

Then login to mysql as root using the password you've defined when you installed MariaDB.

然后使用您在安装 MariaDB 时定义的密码以 root 身份登录 mysql。

mysql -u root -p

Next, issue following command:

接下来,发出以下命令:

CREATE DATABASE phpmyadmin;

Then, issue following command: (Do not forget to replace changethispasswordwith your own password of choice.)

然后,发出以下命令:(不要忘记用您自己选择的密码替换changethispassword。)

GRANT ALL ON phpmyadmin.* TO phpmyadmin@localhost IDENTIFIED BY 'changethispassword';

Exit mysql>using:

退出mysql>使用:

\q

Next, edit the database configuration:

接下来,编辑数据库配置:

sudo gedit /etc/phpmyadmin/config-db.php

Edit the dbpass parameter with the password you've just defined.

使用您刚刚定义的密码编辑 dbpass 参数。

<?php
##
## database access settings in php format
## automatically generated from /etc/dbconfig-common/phpmyadmin.conf
## by /usr/sbin/dbconfig-generate-include
##
## by default this file is managed via ucf, so you shouldn't have to
## worry about manual changes being silently discarded.  *however*,
## you'll probably also want to edit the configuration file mentioned
## above too.
##
$dbuser='phpmyadmin';
$dbpass='changethispassword';
$basepath='';
$dbname='phpmyadmin';
$dbserver='localhost';
$dbport='';
$dbtype='mysql';

Replace changethispasswordwith your own and save. (It must've been already set correctly.)

changethispassword替换为您自己的密码并保存。(它必须已经正确设置。)

回答by Harabagiu Andrei

Our server config - Debian 8.x Mysql 5.7 PHP 5+7 Apache 2.4

我们的服务器配置 - Debian 8.x Mysql 5.7 PHP 5+7 Apache 2.4

This should work :

这应该工作:

  • unistall phpmyadmin (--purge)
  • reinstall phpmyadmin (ignore errors)
  • check for existence of phpmyadmin user and/or database in mysql using mysql console or whatever means.
  • If they don't exist, manually create them and GRANT phpmyadmin user all privileges on phpmyadmin table.

  • manually edit /etc/dbconfig-common/phpmyadmin.conf so as it reflects your current mysql server setup

  • 卸载 phpmyadmin (--purge)
  • 重新安装 phpmyadmin(忽略错误)
  • 使用 mysql 控制台或任何方式检查 mysql 中是否存在 phpmyadmin 用户和/或数据库。
  • 如果它们不存在,请手动创建它们并授予 phpmyadmin 用户对 phpmyadmin 表的所有权限。

  • 手动编辑 /etc/dbconfig-common/phpmyadmin.conf 以反映您当前的 mysql 服务器设置

dbc_dbserver = 'your_server'
dbc_dbport = 'your_mysql_port'
and any dbc_ fields that you feel need completion at this time
  • manually edit /etc/phpmyadmin/config-db.phpso as it reflects your current mysql server setup
  • 手动编辑/etc/phpmyadmin/config-db.php以反映您当前的 mysql 服务器设置
$dbserver = same_as_above
$dbport = your_mysql_listening_port
etc. - any other fields that you feel needs completing.
  • run dpkg-reconfigure phpmyadminfrom console with root or administrative privileges

  • choose Reinstall database for phpmyadmin - YES !!

  • when configuration window asks what you want to do with existing configuration file, choose - "Keep the local version currently installed".

  • In the console output you shouldn't have any mysql empty port errors anymore.

  • dpkg-reconfigure phpmyadmin从具有 root 或管理权限的控制台运行

  • 选择为 phpmyadmin 重新安装数据库 - 是的!!

  • 当配置窗口询问您要对现有配置文件做什么时,选择 - “保留当前安装的本地版本”。

  • 在控制台输出中,您不应再有任何 mysql 空端口错误。

That worked for me.

那对我有用。

回答by marw

None of the above helped in my case - because, somehow, mysqlwas not running / was not installed (check by sudo systemctl status mysql).

以上对我的情况都没有帮助 - 因为,不知何故,mysql没有运行/没有安装(检查sudo systemctl status mysql)。

  1. Skip the error in Phpmyadmin installation.
  2. Reinstall mysql by sudo apt-get install mysql-server mysql-client.
  3. Reconfigure with sudo dpkg-reconfigure phpmyadminand accept the defaults - they will be a bit different this time (but you may want to set the passwords).
  4. Say yes to overwrite the config file with maintainer's version.
  1. 跳过 phpmyadmin 安装中的错误。
  2. 重新安装mysql sudo apt-get install mysql-server mysql-client
  3. 重新配置sudo dpkg-reconfigure phpmyadmin并接受默认值 - 这次它们会有所不同(但您可能想要设置密码)。
  4. 说是用维护者的版本覆盖配置文件。

By the way, the port in phpmyadmin.conf remained dbc_dbport=''.

顺便说一下,phpmyadmin.conf 中的端口仍然是dbc_dbport=''

回答by Hungerburg

Another workaround, I was updating Ubuntu 14.04 -> 16.04:

另一个解决方法,我正在更新 Ubuntu 14.04 -> 16.04:

  • In the wizard select "tcp/ip" as connection method, localhost port 0
  • Read the phpmyadmin user password from /etc/phpmyadmin/config-db.php
  • Change the phpmyadmin user password in the db to it
  • Paste it into the wizard (twice)
  • 在向导中选择“tcp/ip”作为连接方法,本地主机端口 0
  • 从 /etc/phpmyadmin/config-db.php 读取 phpmyadmin 用户密码
  • 将db中的phpmyadmin用户密码改成它
  • 将其粘贴到向导中(两次)

Wizard will run through :)

向导将运行:)

回答by vanjavk

Along with the

随着



My machine configuration - Ubuntu 16.04 - MySql 5.7.13 - PHP 7.0.8 - Apache 2.4.18

我的机器配置 - Ubuntu 16.04 - MySql 5.7.13 - PHP 7.0.8 - Apache 2.4.18

Edit the file /etc/dbconfig-common/phpmyadmin.conf, changing

编辑文件/etc/dbconfig-common/phpmyadmin.conf,更改

dbc_dbport='' to dbc_dbport='0'

After editing the file and saving it, if you are still on the dbconfig-common wizard select retry; if not run sudo dpkg-reconfigure phpmyadmin(choose Yes when asked you if you want to Reinstall database for phpmyadmin) and continue normally without changing any value. If you want to change some value do it in the file that you have edited before.

编辑文件并保存后,如果您仍然在 dbconfig-common 向导中,请选择重试;如果不运行sudo dpkg-reconfigure phpmyadmin(在询问您是否要为 phpmyadmin 重新安装数据库时选择是)并继续正常运行而不更改任何值。如果您想更改某个值,请在您之前编辑过的文件中进行更改。

When configuration window asks what you want to do with existing configuration file choose Keep the local version currently installed.

当配置窗口询问您要对现有配置文件做什么时,选择保留当前安装的本地版本。

At this point you can check the differences and only those must exist that you made in the file.

在这一点上,您可以检查差异,只有那些必须存在于文件中的差异。



Solution I also had to change this line:

解决方案我也不得不改变这一行:

"&& ($analyzed_sql_results['select_expr'][0] == '*')))" to "&& ($analyzed_sql_results['select_expr'][0] == '*'))"

After that everything worked!

之后一切正常!

回答by Petr Kosvanec

I solved this after I added passwords to both 'mysql' root and 'mysql' user. If you leave one or both of the two empty, you can do:

我在向 'mysql' root 和 'mysql' 用户添加密码后解决了这个问题。如果将两者之一或两者都留空,则可以执行以下操作:

sudo -i

sudo -i

check:

查看:

whoami

whoami

if 'root', type:

如果是“root”,请输入:

mysql, or mysql -u root -pin case you already had a password for the root.

mysql,或者mysql -u root -p如果您已经有 root 的密码。

mysql terminal opens; then I added the passwords:

mysql终端打开;然后我添加了密码:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH my_sql_native_password BY 'newpassword';

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'newpassword';

And/or the same for 'user' if needed. Then once I made the passwords for my user in MySQL and phpMyAdmin identical, I was done.

如果需要,和/或“用户”相同。然后一旦我在 MySQL 和 phpMyAdmin 中为我的用户设置了相同的密码,我就完成了。

Before adding the passwords I applied @William Ardilla's as well as @user5781956's advice. Perhaps only @William Ardilla's is enough.

在添加密码之前,我应用了 @William Ardilla 和 @user5781956 的建议。也许只有@William Ardilla 就足够了。