recreate project
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
//create the docker image:
|
||||
docker build -t lamp-codeigniter4 .
|
||||
docker build --no-cache -t lamp-codeigniter4 .
|
||||
|
||||
//run the container only port 80 exposed.
|
||||
docker run -d -p 8080:80 --name lamp-codeigniter4-container lamp-codeigniter4
|
||||
|
||||
//run the container with port 80, 3306 exposed.
|
||||
docker run -d -p 8080:80 -p 3306:3306 --name lamp-codeigniter4-container lamp-codeigniter4
|
||||
|
||||
|
||||
|
||||
//run the shell on container:
|
||||
docker exec -it lamp-codeigniter4-container bash
|
||||
|
||||
//install nano
|
||||
apt install nano
|
||||
|
||||
|
||||
//open mysql and execute the following
|
||||
mysql -u root -ppassword
|
||||
|
||||
//create user and grant access to localhost
|
||||
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password';
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'alrahma'@'localhost' WITH GRANT OPTION;
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
|
||||
//create user and grant access to "192.168.3.%"
|
||||
CREATE USER 'alrahma'@'192.168.3.%' IDENTIFIED BY '@alrahma2024';
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'alrahma'@'192.168.3.%' WITH GRANT OPTION;
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
//exit mysql.
|
||||
|
||||
//update the config to enable accepting requests from all IP's
|
||||
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf //and add thefollowing line
|
||||
bind-address = 0.0.0.0
|
||||
|
||||
sudo service mysql restart
|
||||
|
||||
|
||||
//update these files database config, open each file
|
||||
nano /var/www/html/codeigniter4/app/Views/frontend/partials/navbar.php
|
||||
nano /var/www/html/codeigniter4/app/db_connection.php
|
||||
nano /var/www/codeigniter/app/Config/Database.php
|
||||
nano /var/www/codeigniter/app/Controllers/ParentController.php
|
||||
|
||||
and look for those lines
|
||||
$host = 'localhost';
|
||||
$dbname = 'school';
|
||||
$username = 'root';
|
||||
$password = '';
|
||||
|
||||
|
||||
|
||||
and update them as follow:
|
||||
|
||||
// new Database configuration
|
||||
$host = '127.0.0.1';
|
||||
$dbname = 'school';
|
||||
$username = 'admin';
|
||||
$password = 'password';
|
||||
|
||||
// Database configuration
|
||||
$host = '192.168.3.110';
|
||||
$dbname = 'school';
|
||||
$username = 'alrahma';
|
||||
$password = '@alrahma2024';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user