Search code examples
wordpresscloud9-ide

c9.io wordpress setup issue


I've been trying to setup a wordpress site through c9.io but have been experiencing some issues. I've followed the instructions to the letter(as posted on their website) and I still seem to be having some problems getting it set up. I did the following steps:

  1. Create the wordpress instance through the c9.io dashboard
  2. start and create the mysql database using the following command: "mysql-ctl start"
  3. Go to the index.php file and run it.
  4. Once the index.php file runs, follow the link to setup the wordpress site.

After doing all of those 4 steps and I click the link that is produced from running the index.php file, I get the following message from the browser: "Error establishing a database connection". I don't know what I'm doing wrong since I've been following the instructions as closely as I possibly could. The instructions can be found from this link btw: https://docs.c9.io/v1.0/docs/running-wordpress-on-cloud9

If anyone can tell me what I'm doing wrong and how to fix it I would greatly appreciate it. It seems like everything is working properly until I click on the link produced by index.php. Once I click on that link I receive the error message. Please let me know how you guys were able to remedy this issue. Thanks.


Solution

  • Due to the fact that your cloud9 username is longer than 16 characters and MySQL usernames cannot be more than 16 characters long, you would have to update your wp-config.php to pass only the first 16 characters. Currently it should say something like:

    define('DB_USER', getenv('C9_USER'));
    

    you can replace getenv('C9_USER') with the first 16 characters of your username. This should make it work.