On Fedora 25, I want to develop a Wordpress website. Here's a summary of what I did, but I still cannot get it to work and enter Wordpress management panel:

1- I started MySQL by running
sudo systemctl start mariadb
2- I started Apache by running
sudo systemctl start httpd
3- I unzipped Wordpress 4.7.4 to /var/www/html. I also changed the ownership of the wordpress folder to john:apache.
4- I created a database in mysql:
5- I added a database user:
CREATE USER 'john'@'localhost' IDENTIFIED BY 'P@ssw0rd'
6- I created wp-config.php inside the wordpress folder by cp wp-config-sample.php wp-config.php and edited it as follows:

define('DB_NAME', 'mydb');

/** MySQL database username */
define('DB_USER', 'john');

/** MySQL database password */
define('DB_PASSWORD', 'P@ssw0rd');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', 'utf16_persian_ci');

Now when I open http://localhost/wordpress in my browser, I see a big "Error establishing a database connection".

When I open http://localhost/wordpress/wp-admin an error page appears saying:

We were able to connect to the database server (which means your username and password is okay) but not able to select the mydb database.

I do not know what I did wrong. I am user the database exists, but have no idea why Wordpress cannot connect to it.

  • 2
    Why are you doing a manual install rather than the recommended method of using the inbuilt installer? No need to manually input any database details, in fact by doing so you are stopping WordPress populating the SQL because in neither of your steps have you imported the SQL database that comes with WordPress... if my assumption is correct simply delete the WordPress directory and start over using the recommended method. Apr 24, 2017 at 21:02
  • +1 @SimonHayter - given the complexity of WordPress, the auto install is stupidly easy.
    – Steve
    Apr 24, 2017 at 23:07
  • @Simon you're right. Auto install is cool but it didn't work out for me as I guess it's typical for Linux due to its permission intricacies. Apr 25, 2017 at 3:55
  • 1
    Its not typical for it not to work. If your server is having difficulties installing it then it most likely have problems using it. Apr 25, 2017 at 7:07

1 Answer 1


Since the error says that connection to the database was OK, in addition to the above, you also need to run the following command:

mysql> GRANT ALL PRIVILEGES ON mydb.* TO "john"@"localhost"
    -> IDENTIFIED BY "P@ssw0rd";

Once this is run in MySQL, Wordpress start page brings up its Welcome page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.