Hi Friends,
I am trying to accomplish this task which has seven sub-tasks but somewhere I am failing & unable to complete even after multiple try. I am seeking your help & in providing some inputs if possible that can help me resolving the problem.
a. Install/Configure MariaDB server. - Success
b. Create a database with name kodekloud_db8. - Success
c. There is a DB dump on jump_host under location /home/thor/db.sql. Restore this database in newly create database. - Success
d. Create a user kodekloud_tim and set any password you like. - Success
e. Grant full permissions to user kodekloud_tim on database kodekloud_db8. - I am doubtful though I am following the right process.
f. Update database related details in /data/wp-config.php file on storage server which is our NFS server having a share /data that is mounted on each app server on location /var/www/html. (for more details about how to update WordPress config file please visit Editing wp-config.php â Documentation â WordPress.org) - Success as per process but not sure if any mistake from myside.
g. You can access the website on LBR link, to do so click on the + button on top of your terminal and select option Select port to view on Host 1 and after adding port 80 click on Display Port. - Failing with error âError establishing database connectionâ.
Please suggest if any correction required in my approach.
First we need to understand the error message.
Please turn on ă define('WP_DEBUG', false);ăto define('WP_DEBUG', true);
in the file /data/wp-config.php on NFS server.
It will tell us the exact error message for db connection.
Then, need to check the grant of DB to a particular user.
I forgot once to execute ăFLUSH PRIVILEGES;ăwhich simply assign new privileges.
I hope you will get some pointers and complete your task.
@pmpcert2013@Tej-Singh-Rana@hasmukhrathod@Lalit
There is a DB dump on jump_host under location /home/thor/db.sql. Restore this database in newly create database. -
for this step. should I copy this sql file to db server using scp command and restore the sql from db server on newly created database?
or this should be done in a different way?
could you please check and advise.
I think you have problems while connecting to database. And it must be related to the user privileges.
Before you modify user privilege, I request you to check if you are able to connect using those user credentials from terminal.
If it fails, then drop your user and execute as below,
MariaDB [(none)]> drop user âkodekloud_timâ@â%@%â;
MariaDB [(None)]> create user âkodekloud_timâ@â%â identified by âPra2468@â ;
MariaDB [(None)]> grant all privileges on kodekloud_db8.* to âkodekloud_timâ@â%â;
Hey @bushido I tired but still not luck with the advise you gave, can you please advise what the issue could be ? @pmpcert2013 Hey did you get this resolved ? if so please advise how to correct the error " Error establishing database connection" @Tej-Singh-Rana would you be able to give some input
mysql -u root -p
create database kodekloud_db7;
create user âkodekloud_topâ@localhost identified by âpassâ;
grant all on kodekloud_db7.* to âkodekloud_topâ identified by âpassâ WITH GRANT OPTION;
grant all privileges on kodekloud_db7.* to âkodekloud_topâ@â%â WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
[root@stdb01 peter]# vi /etc/my.cnf
bind-address=172.16.239.10
port=3306
to import dump
mysql -u kodekloud_top -p kodekloud_db7 < /tmp/db.sql
systemctl restart mariadb
To Validate from db server
mysql -u kodekloud_top -p -h stdb01
mysql -u kodekloud_top -p -h localhost
sudo sed -i 's/dbname/kodekloud_db7/g' /data/wp-config.php
sudo sed -i 's/dbuser/kodekloud_top/g' /data/wp-config.php
sudo sed -i 's/dbpass/pass/g' /data/wp-config.php
sudo sed -i 's/dbhost/stdb01/g' /data/wp-config.php
one more step to validate my sql connection from app server:
login app server install my sql client and try to login mariadb using specified user
app server
yum install mysql -y
mysql -u kodekloud_top -p -h stdb01
I have issueâs completing this task, Getting âError Establishing Database Connectionâ issues.
Guyâs please help me out to finish the task. PFA screenshots.