1. sudo apt update2. sudo apt upgrade3. sudo apt install gnupg2 lsb-release curl software-properties-common ufw4. sudo ufw allow sshIf there are any other ports you need to allow in before you enable the firewall use:ufw allow <portnumber>5. sudo ufw enableOptional for POSIX compatibility:6. sudo apt install net-tools
2. sudo dpkg -i percona-release_latest.generic_all.deb3. sudo percona-release setup ps804. sudo apt update
1. sudo apt install percona-server-serverThis will install the server and prompt to setup a new root password for MYSQL (not your system root user).
2. sudo systemctl enable mysql3. sudo systemctl start mysql4. sudo systemctl status mysql5. Check status: sudo systemctl status mysql
1. sudo usermod -aG mysql <username>Example: sudo usermod -aG mysql alice
2. create /etc/mysql/certs for SSL certificatessudo mkdir -p /etc/mysql/certs3. change ownership to mysqlsudo chown -R mysql:mysql /etc/mysql4. change permission to allow group to read and write /etc/mysql/certssudo chmod -R ug+rw /etc/mysql/certs
By default, MySQL on Debian binds to 127.0.0.1 (localhost). You must change it to listen on an external IP.
1. Create /etc/mysql/mysql.conf.d/network-access.cnfsudo nano /etc/mysql/mysql.conf.d/network-access.cnf2. Add the following:[mysqld]
bind-address = 0.0.0.03. Restart: sudo systemctl restart mysql4. confirm: sudo netstat -tnlp | grep 33065. Allow mysql port 3306 through firewall:To allow 3306 for everyone in the network: sudo ufw allow 3306/tcpTo allow specific host by IP:1. If you added rule to allow everyone, delete it: sudo ufw delete allow 3306/tcp2. sudo ufw allow from <IPADDRESS> to any port 3306 proto tcpExample, using 192.168.100.2: sudo ufw allow from 192.168.100.2 to any port 3306 proto tcp
1. sudo mysql_secure_installation
1. Select username to add.NOTE: Our example user is "sqladmin", replace this with your own.2. mysql -u root -pEnter your password for mysql user, root. (NOTE this is not your system root user).
This should enter the MYSQL console/prompt: mysql>3. Add the user.NOTE: replace <password> with actual new password for the user.
mysql> CREATE USER 'sqladmin'@'localhost' IDENTIFIED BY '<password>';mysql> GRANT ALL PRIVILEGES ON *.* TO 'sqladmin'@'localhost' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
4. If you have more admins to add, repeat steps 1-3 for each SQL user.
5. Logout of MYSQL:mysql> quit
1. Select the name of your database. For this example we'll use 'testdb'2. Login to mysql: mysql -u testuser -p3. Create your database:mysql> CREATE DATABASE testdb;mysql> quit4. At this point, you've setup your first database. For the rest, refer to MySQL guides.