0

I created a WordPress site on phpfog, then used git to download it locally. The way phpfog is set up I can't get to the wordpress database and access it from my localhost installation. I need to set up another database. So far, I haven't been able to get it to work. Phpmyadmin won't open. (I've also tried a new installation of Wordpress and the same thing happens)

I think the problem is that i need a database. But, where do I put it? What directory?

Here is where I'm at right now:

in the wp-config.php file, I've changed the parameters "user" to 'root' and the password to 'mypassword' in mylini, I've changed the password param to 'mypassword' and the port to '3306'

in config.inc.php, I've changed "user" to 'root' and 'password' to ''

When I try to connect to phpmyadmin, I get this.

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.

I've tried a number of ideas on various forums, but nothing gets me past this yet. Any ideas would be awesome.

Greg

  • Is your mysql set to accept tcp connections? By default it isn't for security reasons. On unix-ish systems, it uses local unix-domain sockets only. – Marc B Sep 24 '12 at 01:21
  • This is Windows 7. I don't know the answer. I have been able to make database connections remotely beflre, though. – I_miss_Steve_already Sep 24 '12 at 01:26
  • I'd still suggest Wamp - highly. But, maybe daniweb.com/web-development/php/threads/163884/phpmyadmin-displays-error#post763673 , www.apachefriends.org/f/viewtopic.php?p=181829#p181829 or stackoverflow.com/questions/1276538/phpmyadmin-cant-connect-invalid-setings-ever-since-i-added-a-root-passwor might help? I copied and pasted your error into google and there's plenty more good answers/discussions around that error. – David Hobs Sep 25 '12 at 13:41
  • I ended up re-installing XAMPP. I think what was going on was that I had my password wrong for mysql, and couldn't figure out what it was. No way to recover this except to reinstall. Now it works. – I_miss_Steve_already Sep 26 '12 at 14:51

2 Answers2

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.

David Hobs
  • 4,351
  • 2
  • 21
  • 22
  • Everything is in place. I've installed a new Wordpress instance and put it in the xampp/htdocs/ folder. Haven't changed the placement of any folders. – I_miss_Steve_already Sep 24 '12 at 03:16
  • The thing that is hanging me up is that I can't open phpadmin to create a database. I can run mysql from the command line, but I can't create a database (says there's a syntax error, but don't think so. CREATE DATABASE ''databasename''; I've tried all types of quote arrangements I've got full permissions on the folders being used. – I_miss_Steve_already Sep 24 '12 at 03:22
  • The problem was that I was using the wrong password for mysql. To figure this out, I ended up reinstalling XAMPP so I could re-trace my steps from the beginning. But, as soon as I got the password right, everything else fell into place. Somebody please hand me my "stupid" sign! – I_miss_Steve_already Sep 26 '12 at 14:54
  • *face palm* It happens to all of us - all too often. Glad it worked out. – David Hobs Sep 28 '12 at 01:22
0

I would recommend developing locally. That is, you develop stuff on your own machine with a dummy database. When you are happy with your changes, you upload them to your server, which works with your real (production) database.

To hook your local copy up with a database:

  1. Install MySQL on your local machine
  2. Open an interface to MySQL. On a UNIX-like system, you could type mysql on the command line
  3. CREATE DATABASE ''databasename'';
  4. GRANT ALL PRIVILEGES ON ''databasename''.* TO "''username''"@"''hostname''" IDENTIFIED BY "''password''"; (if hostname is %, you can log in from all hosts)
  5. FLUSH PRIVILEGES;
  6. Update your local wp-config.php with your local credentials and database name
  • Right. That's what I'm doing. I tried Just Thomas's idea and I think there's wrong with my sql installation. It won't let me create a database, saying 'You have an error in your SQL Syntax near 'database name' I tried it with single quotes, double quotes double single quotes... Would it matter that it shows up as smart quotes in the command prompt window.? – I_miss_Steve_already Sep 24 '12 at 02:07