An Interest In:
Web News this Week
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
- March 15, 2024
- March 14, 2024
September 17, 2022 12:57 pm GMT
Original Link: https://dev.to/harrsh2124/deploy-mysql-in-ubuntu-server-2gla
Deploy MySQL in Ubuntu server
Create a new ssh key in your computer.
Add the pub key to the AWS key pair directory.
Create new Ubuntu server and add access to port 3306 to it.
Connect to server using the same key.
Run the following commands in the server.
sudo apt updatesudo apt upgrade -ysudo reboot
Open ports for UFW.
sudo ufw allow OpenSSHsudo ufw allow 3306sudo ufw enable
Install NGINX
sudo apt install nginx
Check if NGNIX is working by accessing the public ipv4 address in the browser.
Allow NGINX for UFW.
sudo ufw app listsudo ufw allow 'Nginx Full'
Setup MySQL.
sudo apt install mysql-serversudo mysql
Exit if everything worked.
Install phpMyAdmin.
sudo apt install php-fpm php-mysqlsudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl
Create new SQL user.
sudo mysqlmysql> CREATE USER '<user>'@'localhost' IDENTIFIED WITH caching_sha2_password BY '<password>';mysql> GRANT ALL PRIVILEGES ON *.* TO '<user>'@'localhost' WITH GRANT OPTION;mysql> exit
Copy phpMyAdmin configuration to NGINX.
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadminsudo service nginx restartsudo nano /var/www/html/index.php
Add the following lines
<?phpphpinfo();?>
sudo service nginx restartphp -v
Check the PHP version from here.
sudo nano /etc/nginx/sites-available/default
Change the PHP version.
include fastcgi_params;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
sudo service nginx restartsudo nano /etc/mysql/mysql.conf.d/mysqld.cnf# Change the bind address to 0.0.0.0sudo systemctl restart mysql
Change host of the MySQL user.
sudo mysqlmysql> SELECT User, Host FROM mysql.user;mysql> UPDATE mysql.user SET HOST='%' WHERE User='<user>';mysql> SELECT User, Host FROM mysql.user;# % is the wildcard to connect from everywhere.mysql> exit
Original Link: https://dev.to/harrsh2124/deploy-mysql-in-ubuntu-server-2gla
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To