How to access remote MySQL database in Remote phpMyAdmin - ubuntu
Architecure
Working process :
vsftpd
Firstly , we have to implement the vsftpd installation and configuration. we need to follow the below command
# Install the vsftpd packages
sudo apt update
sudo apt install vsftpd -y
# create the new user
sudo adduser ashli # password - Password@123
# Create a directory for user and document root
sudo mkdir -p /etc/vsftpd/users /var/www/html/demo
# give the owner permission of new user
sudo chown -R ashli:ashli /var/www/html/demo
# give the local root
echo "local_root=/var/www/html/demo" | sudo tee -a /etc/vsftpd/users/ashli
# restrict the users at root level
echo "ashli" | sudo tee /etc/vsftpd.chroot_list
After creating the configuration file, we need to start the service and check the status of the service
# start the vsftpd service
sudo systemctl start vsftpd
# status of vsftpd service
sudo systemctl status vsftpd
# verify the configuration
sudo ss -tulpn | grep vsftpd
phpmyadmin remote server (public)
Then, we have to install the phpmyadmin in my local
sudo apt update
sudo apt install apache2 php php-gd php-zip php-mysql -y
sudo service apache2 start
sudo service apache2 status
phpmyadmin configuration:
firstly, we have to download a phpmyadmin configuation file in my local using this link - https://www.phpmyadmin.net/
then, we have to extract the zip file and rename the filename like phpmyadmin
Then, use vsftpd to push the phpmyadmin file to the apache2 document root (/var/www/html/demo)
Output:after the above phpmyadmin setup, we will get this page
MySQL remote server (private)
Firstly, create the remote mysql database
# install the mysql packages
sudo apt update
sudo apt install mysql-server -y
sudo service mysql start
sudo service mysql status
# create the mysql user to connect the phpmy admin
sudo mysql
CREATE USER 'ashli'@'%' IDENTIFIED BY 'Password@123';
GRANT ALL PRIVILEGES ON *.* to 'ashli'@'%';
FLUSH PRIVILEGES;
Configure MySQL for remote connections
# Log into your MySQL database server and open the configuration file with the command:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
# Change that line instead of bind-address = 127.0.0.1:
bind-address = 0.0.0.0
# Restart the MySQL service with:
sudo systemctl restart mysql
output:after the above mysql setup, we will get this output.
configure the remote database details in my remote phpmyadmin file
# find the phpmyadmin configuration file
cd /var/www/html/demo/phpmyadmin
ll | grep config
mv config.sample.inc.php config.inc.php
Add the mysql remote configuration in remote phpmyadmin server
# sudo vim /var/www/html/demo/phpmyadmin/config.inc.php
$i++;
$cfg['Servers'][$i]['host'] = '172.31.1.142'; # Public IPv4 DNS Name
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['compress'] = FALSE;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'ashli';
$cfg['Servers'][$i]['password'] = 'Password@123';
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
OUTPUT
Check the remote db details match into the remote phpmyadmin - if it is matched the configuration correctly configured.
How to access remote MySQL database in Remote phpMyAdmin - ubuntu
Architecure
Working process :
vsftpd
Firstly , we have to implement the vsftpd installation and configuration. we need to follow the below command
Add the configuration file for vstfpd
After creating the configuration file, we need to start the service and check the status of the service
phpmyadmin remote server (public)
Then, we have to install the phpmyadmin in my local
phpmyadmin configuration:
phpmyadmin
phpmyadmin
file to the apache2 document root (/var/www/html/demo
)Output:![image](https://github.com/fourtimes/php/assets/91359308/e0fb7f22-b1ab-4e3a-ad2b-0364c8a7e8b6)
after the above phpmyadmin setup, we will get this page
MySQL remote server (private)
Firstly, create the remote mysql database
Configure MySQL for remote connections
output:![image](https://github.com/fourtimes/php/assets/91359308/51d4574e-3323-44a5-86a5-3e318e4c601c)
after the above mysql setup, we will get this output.
configure the remote database details in my remote phpmyadmin file
Add the mysql remote configuration in remote phpmyadmin server
OUTPUT
Check the remote db details match into the remote phpmyadmin - if it is matched the configuration correctly configured.