0

我在 phpfog 上创建了一个 WordPress 站点,然后使用 git 将其下载到本地。phpfog 的设置方式我无法访问 wordpress 数据库并从我的本地主机安装访问它。我需要建立另一个数据库。到目前为止,我还无法让它工作。phpmyadmin 打不开。(我也尝试了新安装的 Wordpress 并且发生了同样的事情)

我认为问题是我需要一个数据库。但是,我把它放在哪里?什么目录?

这是我现在所处的位置:

在 wp-config.php 文件中,我在 mylini 中将参数“user”更改为“root”,将密码更改为“mypassword”,将密码参数更改为“mypassword”,端口更改为“3306”

在 config.inc.php 中,我将“用户”更改为“root”,将“密码”更改为“”

当我尝试连接到 phpmyadmin 时,我得到了这个。

Error
MySQL said:

Cannot connect: invalid settings.
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

我在各种论坛上尝试了许多想法,但没有什么能让我超越这一点。任何想法都会很棒。

格雷格

4

2 回答 2

1

First - It's hard to know how to answer as your question is rather vague. There's two very different things involved. First, setting up xampp. Then setting up wordpress. I couldn't quite figure out which you were referring to for each error, so here's a long winded explination/answer in case any thing helps:

Are you on Linux I presume? On windows it was a bit of a hassle and wamp was 20x easier. But, you might consider a preconfigured stack that includes xampp (and necessary includes) and a few other goodies, some come with wordpress installed. I haven't personally used them, but wish I had - google ought to help out there.

I'm assuming you went to (http://)localhost/phpmyadmin, right?

First you need to get there before you hook up wordpress. As for hooking up xampp, it does take some configuration, so make sure you follow the docs - it's not quite a one click install.

Once you have xampp setup, you need to create a new database in localhost/phpmyadmin for wordpress. Then go back to your file folders, which should be located in xampp/htdocs/yourwordpressinstall.

config.inc.php - is that your wordpress directory? It needs to be wp-config.php (if it's not already there, save wp-config-sample.php as such). Open that, change server to localhost, database to the name of the database you just created. The username and password are the ones when you installed xampp. By default, I think they're User: Root, and PW: unset(blank). If you go to phpmyadmin there's a link to security and it'll show you there. localhost/phpmyadmin

Now, you should be able to type in the location of the filefolders.

localhost/wordpress/ - assuming your server is started, and the wordpress root folder is name "wordpress" and is in the xampp/htdocs/ folder.

From there you should see wordpress.

However, if you've exported your database, you'll need to change the site_url and home_url options to the new url. I'd suggest using the plugin wp db migrate (something like that) which will allow you to export the database from wordpress and auto set the values. Once the plugin is installed it's under the tools menu.

If you google migrating wordpress, you'll find plenty of tutorials and guides for moving wordpress from local to live, or as you're doing, online to local.

Sorry, I have to run, so I'm not sure if I really got to exactly what you needed, but that should get you started and give you the keywords to let google and other tutorials/docs get you the rest of the way.

于 2012-09-24T02:10:39.867 回答
0

我建议在本地开发。也就是说,您在自己的机器上使用虚拟数据库开发东西。当您对更改感到满意时,将它们上传到您的服务器,该服务器与您的真实(生产)数据库一起使用。

要将本地副本与数据库挂钩:

  1. 在本地机器上安装 MySQL
  2. 打开 MySQL 的接口。在类 UNIX 系统上,您可以mysql在命令行上键入
  3. CREATE DATABASE ''databasename'';
  4. GRANT ALL PRIVILEGES ON ''databasename''.* TO "''username''"@"''hostname''" IDENTIFIED BY "''password''";(如果主机名是%,则可以从所有主机登录)
  5. FLUSH PRIVILEGES;
  6. 使用本地凭据和数据库名称更新本地 wp-config.php
于 2012-09-24T01:35:36.250 回答