I typo’ed the 4th of the entries:
define(‘DB_HOST’, ‘1localhost’);
should have read:
define(‘DB_HOST’, ‘localhost’);
Sorry.
Looks like you are just redefining the DB_HOST var?
What are your values for the database, user and password? The user must be database specific with all rights granted.
I have the names dbserver & webserver in the DNS tables. The system responds with the default webpage to either domain name.
I have a link to the wordpress directory in the top level directory of /var/www/html. Setting the browser to webserver.my.net or dbserver.my.net shows the default webpage. webserver.my.net/wordpress or dbserver.my.net or 192.168.1.140/wordpress gets the error response.
They are the same user name and password as I used to verify the login and access using the “mysql” command.
Using the username and password with the “mysql” command allows me to view the database and tables.
I just did not drop those lines into this thread. Sorry for the confusion
Each of the DB_HOST entries that I dropped into this thread was a separate attempt to get this working.
Did you update the config file as per – Edit Config
and follow – Installing WordPress
Which has the mysql client process below:
$ mysql -u adminusername -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5340 to server version: 3.23.54
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> CREATE DATABASE databasename;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON databasename.* TO "wordpressusername"@"hostname"
-> IDENTIFIED BY "password";
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql> EXIT
Bye
$
For clarity:
// ** MySQL settings ** //
define(‘DB_NAME’, ‘wordpress’);
define(‘DB_USER’, ‘root’);
define(‘DB_PASSWORD’, ‘1pass1word1’);
define(‘DB_HOST’, ‘localhost’);
define(‘DB_CHARSET’, ‘utf8’);
define(‘DB_COLLATE’, ”);
Line four is the line that I changed in each attempt to get this to work & what I showed in my first post.
[root@mfg-dbserver ~]# mysqlshow wordpress -u wordpress -p1pass1word1
Database: wordpress
+——–+
| Tables |
+——–+
+——–+
Generally root does not work (strange but true) – you need a database specific user. Try creating a database specific user and granting all privileges for your database which you call ‘wordpress’.
I forgot that I just changed the user name in an attempt to debug this to root. Should read “wordpress” instead of root. I figured if the root couldn’t access it wasn’t a permission thing.
my database specific user is call “wordpress” that is the user name that I used to test access with the ‘mysql’ & ‘mysqlshow’ commands. That works as far as mysql is concerned but not from a wordpress setup. That is what I’m not clear about.
I verified that I can access the DB from a different system.
[root@Centos63 CentOS]# mysql -h webserver -u wordpress -p wordpress -p1pass1word1
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.1.66 Source distribution
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> show tables
-> ;
Empty set (0.00 sec)
mysql> exit;
Bye
Looks like you are getting valid results from the command line. Have you tried connecting via a PHP script for debugging purposes?
Something like below or even use the MySQL or MySQLi API which would be closer to WordPress (obviously insert or assign your values for $hostIn, $dbIn, $userIn and $passwordIn):
<?php
$hostIn = 'localhost';
$dbIn = 'testconnect';
$userIn = 'testuser';
$passwordIn = 'testpass';
try {
$MySQLDataBaseLink = new PDO(
"mysql:host=" . $hostIn . ";dbname=" . $dbIn, $userIn,
$passwordIn);
$MySQLDataBaseLink->setAttribute(PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION);
echo 'Yippee - good connection';
} catch(PDOException $e) {
echo '<h3>Catch Connect Error--->>> '
. $e->getMessage() . '</h3>';
return false;
} //End Try Catch
?>
I get back:
[root@dbserver ~]# php test.php
Yippee – good connection
[root@dbserver ~]#