Windows 上的 Magento 安装在 xampp 上显示数据库连接错误?
我正在使用 xampp 版本 1.6.4 和 PHP 版本 5.2.4,并且我尝试在 xampp 上安装 Magento 最新版本。我在配置页面中收到错误。也就是说,它显示'数据库连接错误.'.
我在页面中填写的字段:
数据库连接
- 主机 ----- localhost
- 数据库名称 ---- Magento(已在 phpMyadmin 中创建)
- 用户名 ---- - root
- 密码 ----- 空白
Web 访问选项
基本 URL ------ http://127.0.0.1/magento/
管理路径 ------ admin
启用图表 ---- 选中
在下一步之前跳过基本 URL 验证 --选中
使用Web 服务器 (Apache) 重写 --- 未选中
使用安全 URL (SSL) ---- 未选中
会话存储选项
11.将会话数据保存在 -- 文件系统
我已经在 phpMyadmin 中创建了 Magento 数据库。但是当我单击“继续”时,它显示错误。我不知道为什么?请帮助我。
更新: phpMyadminConfiguration
$cfg['PmaAbsoluteUri'] = '';
$cfg['PmaNoRelation_DisableWarning'] = FALSE;
$cfg['blowfish_secret'] = 'xampp';
$i = 0;
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['ssl'] = false;
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['compress'] = FALSE;
$cfg['Servers'][$i]['controluser'] = '';
$cfg['Servers'][$i]['controlpass'] = ''; // access to the "mysql/user"
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['SignonSession'] = '';
$cfg['Servers'][$i]['SignonURL'] = '';
$cfg['Servers'][$i]['LogoutURL'] = '';
$cfg['Servers'][$i]['nopassword'] = FALSE;
$cfg['Servers'][$i]['only_db'] = '';
$cfg['Servers'][$i]['hide_db'] = '';
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['pmadb'] = '';
I am using the xampp Version 1.6.4 with PHP Version 5.2.4 and I am trying to Install the Magento latest version on xampp.I got the error in the configuration page.That is, it shows the 'Database connection error.'.
Fields I filled up in the Page:
Database Connection
- Host ----- localhost
- Database Name---- Magento(already created in phpMyadmin)
- User Name ----- root
- Password ----- blank
Web access options
Base URL ------ http://127.0.0.1/magento/
Admin Path ------ admin
Enable Charts ---- Checked
Skip Base URL Validation Before the Next Step --Checked
Use Web Server (Apache) Rewrites --- Unchecked
Use Secure URLs (SSL) ---- Unchecked
Session Storage Options
11.Save Session Data In -- File system
I already created the Magento database in the phpMyadmin.But when I click continue it displays error.I dont know why?Please help me in this.
Update: phpMyadminConfiguration
$cfg['PmaAbsoluteUri'] = '';
$cfg['PmaNoRelation_DisableWarning'] = FALSE;
$cfg['blowfish_secret'] = 'xampp';
$i = 0;
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['ssl'] = false;
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['compress'] = FALSE;
$cfg['Servers'][$i]['controluser'] = '';
$cfg['Servers'][$i]['controlpass'] = ''; // access to the "mysql/user"
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['SignonSession'] = '';
$cfg['Servers'][$i]['SignonURL'] = '';
$cfg['Servers'][$i]['LogoutURL'] = '';
$cfg['Servers'][$i]['nopassword'] = FALSE;
$cfg['Servers'][$i]['only_db'] = '';
$cfg['Servers'][$i]['hide_db'] = '';
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['pmadb'] = '';
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
转到 phpMyAdmin 中的用户。
确保您在 Magento 中输入的用户的
host
设置为localhost
而不是%
(任何)。Go to users within phpMyAdmin.
Make sure the
host
for the user you're entering in Magento is set tolocalhost
and not%
(any).这是一个很老的问题,但我最近遇到它,我希望这个答案对其他人有帮助。我的问题归结为在新的 WAMP 安装之上安装了旧版本的 Magento。从 MySQL 5.6.1 开始,have_innodb 变量已被删除。但是,Magento 安装程序会检查该变量,如果找不到它,则会抛出错误。如果您实际检查异常日志,您将看到数据库服务器不支持 InnoDB 的错误。然而,在
catch
处理程序中,它仅记录该异常并抛出通用的“数据库连接错误”消息。如果您确定您的数据库支持 InnoDB,最简单的修复方法是简单地编辑
app\code\core\Mage\Install\Model\Installer\Db.php
,找到checkDatabase< /code> 方法,并注释掉
try
块末尾用于检查 have_innodb 的部分。通常,我不提倡编辑核心文件,但这只是为了让安装程序正常工作,所以我认为它足够安全。希望对处于类似情况的其他人有所帮助。
This is a pretty old question but I came across it recently and I hope this answer helps someone else. My issue came down to an old version of Magento on top of a new WAMP installation. Since MySQL 5.6.1, the have_innodb variable has been removed. However, the Magento installer checks for that variable and throws an error if it doesn't find it. If you actually check the exception log you'll see an error that the database server does not support InnoDB. Yet in the
catch
handler it only logs that exception and throws a generic "Database connection error" message.The simplest fix, if you're sure your DB supports InnoDB, is to simply edit
app\code\core\Mage\Install\Model\Installer\Db.php
, find thecheckDatabase
method, and comment out the portion at the end of thetry
block that checks for have_innodb. Normally, I would not advocate editing core files, but this is only to get the installer working, so I'd say it's safe enough.Hope that helps anyone else in a similar situation.
我遇到了同样的问题,但使用 host:port 后它工作得很好。就我而言,它是 127.0.0.1:3306
I had the same problem, but after using host:port it worked perfectly. In my case its 127.0.0.1:3306
尝试将数据库连接设置主机更改为127.0.0.1
Try to change at Database connection settings host to 127.0.0.1
我有类似的问题。看来它与 DNS 问题有关,因为 Magento 正在寻找 http://xxxxxx.xxx 其中 x 是您创建的任何名称。不要使用 .com、.net 等。例如,创建一些随机的 .ecs。您不能使用 127.0.0.1 作为 Magento 的 URL 或本地主机(至少这是我使用 XAMPPLITE 的经验。
我下载了 HostXpert(免费)并将一个虚拟 URL(如 demo.ecs)分配给 127.0.0.1,然后安装 Magento demo.ecs
在进行安装之前,请验证您的本地主机 demo.ecs 在将其加载到浏览器中时是否正常工作,
希望有所帮助。
I had a similar issue. It appears it is related to a DNS issue in that Magento is looking for a valid type URL of the form http://xxxxxx.xxx where x is whatever name you create. Dont use a .com, .net etc..create some random one .ecs for example. You can't use 127.0.0.1 as the URL or localhost for Magento (at least that was my experience using XAMPPLITE.
I downloaded HostXpert (free) and assigned a dummy URL like demo.ecs to 127.0.0.1 and then did the Magento install to demo.ecs
Before you do the install, verify that your localhost demo.ecs works when you load it into your browser.
Hope that helps.
看来您正在使用 XAMPP 进行本地开发。在这种情况下,您可能还需要查看 BitNami Magento。它与 XAMPP 非常相似,因为它是免费的、多平台的和独立的,但它默认预装了 Magento。
It seems you are using XAMPP for local development. In that case, you may want to also checkout BitNami Magento. It is very similar to XAMPP in that it is free, multiplatform and self-contained, but it comes with Magento preinstalled by default.
您需要在您的 magento 数据库上提供一个具有所有权限的帐户和密码。一旦你点击继续,Magento 就会用一大堆表填充数据库。这可能需要几分钟的时间,具体取决于您的连接或您的 PC(对于本地安装)。
You need to provide an all privileges account with a password on your magento database. Once you click continue Magento will populate the database with a whole bunch of tables. It can take a few minutes depending on your connection or your PC (for local installations).
解决您的问题的步骤。
localhost
并enterenglish
选项localhost/xampp/index.php
页面security
选项卡,点击localhost/security/index.php
页面将会出现root
和密码(如您所愿)数据库连接:
这一切都很完美。
Steps to solve your problem.
localhost
and enterenglish
optionlocalhost/xampp/index.php
page will comesecurity
tab, click on thatlocalhost/security/index.php
page will comeroot
and password (as u want)Database Connection:
That's all perfect.
我认为对于 Magneto 数据库,您需要访问本地主机区域,但假设我们有一个像
http://yoursite.com
这样的网站,并且如果我们在com< 位置替换任何内容/code> 那么程序会怎样呢?我有多个站点并要设置它,但我不想收到错误。
I think for magneto database you need to access to the local host area but let's say we have a site like
http://yoursite.com
and if we substitute anything at the place ofcom
then what will be the procedures? I have multiple sites and going to set this but I do not want to get errors.对我来说这是一个权限问题。
我已从命令行向用户授予所有权限,但通过 phpMyAdmin 重新检查(由于此错误),我注意到该用户没有我设置的权限。
一旦我纠正了这个问题,它就起作用了。
用户部分如下图所示:
phpMyAdmin 用户部分
For me this was a permissions problem.
I had given the user grant all permissions from the commandline but on rechecking through phpMyAdmin (because of this error) I noticed that the user did not have the permissions I had set.
Once I corrected this it worked.
The users section is shown in the image below:
phpMyAdmin Users Section