WebFaction
Community site: login faq

Hi all,

Trying to import a WordPress installation into webfaction servers and I get an "Error establishing a database connection".

Anyone can help?

Configuration: php-5.4 as static app MysQL private instance.

On the mysql private instance, created the user and db for mysql. db_host configured as localhost:prot_given_private_mysql_instance

As it didn't work I also include in .htaccess:

<FilesMatch \.php$>
    SetHandler php54-cgi
</FilesMatch>

from this post: http://community.webfaction.com/questions/8063/php-54-and-wordpress-error-establishing-a-database-connection.

Any help will be appreciated.

Xavi

asked 27 Aug '13, 04:40

xtarafa
323
accept rate: 0%


Hello,

If you are using a private MySQL instance then you need to specify the protocol name and port to which to connect:

mysql -P APP_PORT -u root -p --protocol=tcp -D DBNAME < YOURSQL.sql

Please replace APP_PORT with the port on which MySQL is listening, it is available next to the name of the application in your Control Panel, the Domains/websites -> Applications page.

Remember to replace DBNAME with the name of the actual database, and YOURSQL.sql with the name of the file to be imported.

If you still experience errors then either provide the exact steps you take, or, better yet, open a ticket to us to avoid any sensitive information being displayed out in the open.

Sincerely,

Valentin I. WebFaction Support
--
WebFaction - Smarter web hosting
http://webfaction.com
http://twitter.com/webfaction - http://facebook.com/webfaction

permanent link

answered 27 Aug '13, 10:06

valentini
2614
accept rate: 28%

Hi Valentin,

Thanks for the answer but I guess didn't explain myself. What I mean it is how to access from a PHP. As I said this is an wordpress installation, so I've my wp_config.php configured to access it. From console or phpMyAdmin I have no problem accessing to the database.

Sincerely,

Xavi

(27 Aug '13, 10:10) xtarafa

My mistake. 1) I had confused between private instance and normal BBDD 2) I had a type mismatch on the db name.

permanent link

answered 27 Aug '13, 15:50

xtarafa
323
accept rate: 0%

In php.ini you need to declare: mysql.default_socket = /path/to/your/mysql/socket.sock which should be in /home/username/webapps/mysqlappname/var/mysql.sock

Then just use localhost for the mysql server address. MySQL treats localhost differently than 127.0.0.1 in that localhost will attempt to connect to the default socket, which without telling PHP otherwise is going to be the primary shared MySQL instance on the box.

permanent link

answered 27 Aug '13, 16:29

HittingSmoke
4821930
accept rate: 8%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×242
×168
×84

question asked: 27 Aug '13, 04:40

question was seen: 7,236 times

last updated: 27 Aug '13, 16:29

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM