Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

install mysql on debian

first, update the packages: apt update and apt install gnupg

Next, download MySQL using wget command:
wget https://dev.mysql.com/get/mysql-apt-config_x.x.x-x_all.deb - x.x.x-x is the version.
then
sudo dpkg -i mysql-apt-config_x.x.x-x_all.deb
Update the apt repository:
apt-get update

Install the MySQL Server using the command:
sudo apt-get install mysql-community-server

Now, check the service status with systemctl:
systemctl status mysql.service

Next, run the command as a root user to safely configure the SQL service:
mysql_secure_installation

If you want to allow remote access, edit the file «mysqld.conf» in etc/:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

At the end of the file, add the option "bind_address" with the value of localhost:
bind-address=127.0.0.1

Save the file and restart the service with systemctl:
systemctl restart mysql

 remember to open the MySQL port (it will be good to specify the standard MySQL port). If you use ufw:
ufw allow $yoursqlport

where instead of yoursqlport write your MySQL port.

If you use iptables:
iptables –A INPUT –p tcp –dport $yoursqlport –j ACCEPT
 
PREVIOUS NEXT
Tagged: #install #mysql #debian
ADD COMMENT
Topic
Name
6+7 =