Mobile app version of vmapp.org
Login or Join
Kimberly868

: Cannot connect to Wordpress MySQL on Fedora 25 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

@Kimberly868

Posted in: #Mysql #Php #Wordpress

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:
CREATE DATABASE mydb
CHARACTER SET = UTF16
COLLATE = utf16_persian_ci
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 localhost/wordpress in my browser, I see a big "Error establishing a database connection".

When I open 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.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Kimberly868

1 Comments

Sorted by latest first Latest Oldest Best

 

@Kimberly868

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme