I have done the following for installing and configuring mariadb:
-
ssh peter@stdb01
-
sudo yum install openssh-client
-
scp db.sql peter@stdb01:~/ from jump_host
-
ssh peter@stdb01
-
sudo yum install mariadb-server
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo systemctl status mariadb
sudo mysql_secure_installation
-
CREATE USER kodekloud_gem IDENTIFIED BY ‘password’;
CREATE DATABASE kodekloud_db1;
GRANT ALL privileges ON kodekloud_db1
.* TO kodekloud_gem;
mysql -u kodekloud_gem -p kodekloud_db1 < db.sql;
-
ssh tony@stapp01
Ir0nM@n
mysql -u kodekloud_gem -p -h stdb01
-
ssh steve@stapp02
Am3ric@
mysql -u kodekloud_gem -p -h stdb01
-
ssh banner@stapp03
BigGr33n
mysql -u kodekloud_gem -p -h stdb01
-
edited wp-config in all app servers
db_name ‘kodekloud_db1’
db_user ‘kodekloud_gem’
db_host ;localhost’
db_pass ‘password’
After doing the above steps I am still getting an error: “connection cannot be established to database”
Please see the below screenshots.
Seems like you are passing incorrect DB host i.e localhost in wp-config file. Please not that database is running on Database server instead.
Hi Inderpreet,
I did the same above steps mentioned in my previous post for installing & Configuring
mariadb with changes to user: kodekloud_pop, db: kodekloud_db8.
CREATE USER kodekloud_pop IDENTIFIED BY ‘password’;
CREATE DATABASE kodekloud_db8;
GRANT ALL privileges ON kodekloud_db8
.* TO kodekloud_pop;
mysql -u kodekloud_pop -p kodekloud_db8 < db.sql;
wp-config edited as follows:
db_name ‘kodekloud_db8’
db_user ‘kodekloud_pop’
db_host 'stdb01.stratos.xfusioncorp.com’
db_pass ‘password’
database server hostname from wiki: stdb01.stratos.xfusioncorp.com
The result I keep getting is the same. What am I doing wrong?
for the db host you need to enter ip:port number
In wp-config. php set debug to true. So that you can get error message. what exactly went wrong.Also add port number 3306.in dn=b_host.
Also add 3 lines in /etc/my.cnf file in mysqld section.
[mysqld]
skip-grant-tables
skip-networking=0
skip-binding
1 Like
I went in /etc and ls there on db server but there was no my.cnf file…Can you pls suggest how can get /etc/my.cnf file.
/etc/my.cnf file is default confiuration file.When you install mariadb.Which version db you installed.
you can also check /etc/mysql/my.cnf
@shabbir…Have one more doubt aboult wp-config.php file that it should be edited on all app servers or only should be edited on db server.
Only in the DB server. Apologies you have to change in storage server.
1 Like
@shabbir@Inderpreet… I opened wp-config.php file in db server but its blank and i tried to open it in app server stapp01 there i can see the editable file…plz suggest.
You have to change in storage server NFS share which mounted as /var/www/html all app server. there you can find /data/wp-config.php. in my case. in your case will be different.
Just edit and save in NFS server, It will be reflected in all app servers
I got the same error.
My problem was a wrong permission configuration in the mariadb user.
I could solved thanks to @shabbir tip “set debug to true in wp-config.php”. After that, I could understood where my problem was located.