MySQL Installation and Deployment
It is recommended to use MySQL version 8.0.
Opening Specified Ports or Disabling Firewall
View the ports that are already open:
firewall-cmd --list-portsOpen a specified port (e.g., port 3306 for MySQL):
firewall-cmd --zone=public --add-port=3306/tcp --permanentReload the firewall configuration:
firewall-cmd --reloadConfirm the opened ports:
firewall-cmd --list-portsIf needed, you can stop the firewall:
systemctl stop firewalldCheck the firewall status:
systemctl status firewalld
Basic Environment Preparation
Create a user and group for MySQL:
groupadd mysql useradd -r -g mysql -s /sbin/nologin mysqlInstall dependencies for MySQL:
yum install -y libncurses* libaio* lrzsz*Extract the MySQL installation package:
tar -xvf mysql-8.0.28-linux-glibc2.12-x86_64.tar -C /usr/local/Rename the extracted directory:
mv mysql-8.0.28-linux-glibc2.12-x86_64/ mysqlCreate required directories:
cd /usr/local/mysql/ mkdir dataChange directory ownership:
chown -R mysql:mysql /usr/local/mysql/
Deploy MySQL Service
Initialize the database:
/usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --initializeEdit
my.cnfconfiguration: Create/Edit the configuration file/etc/my.cnfand add the following content:[mysqld] basedir=/usr/local/mysql datadir=/usr/local/mysql/data socket=/usr/local/mysql/data/mysql.sock bind-address = 0.0.0.0 user=root port=3306 log-bin=mysql-bin server-id=1 max_connections=2048 character-set-server=utf8 default-storage-engine=INNODB [client] socket=/usr/local/mysql/data/mysql.sockConfigure environment variables:
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile source /etc/profileConfigure startup script:
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld chmod +x /etc/rc.d/init.d/mysqld cat > /lib/systemd/system/mysqld.service <<EOF [Unit] Description=mysqld After=network.target [Service] Type=forking ExecStart=/etc/rc.d/init.d/mysqld start ExecReload=/etc/rc.d/init.d/mysqld restart ExecStop=/etc/rc.d/init.d/mysqld stop PrivateTmp=true [Install] WantedBy=multi-user.target EOFReload systemd configuration:
systemctl daemon-reloadSet MySQL to start on boot:
systemctl enable mysqldStart MySQL:
systemctl start mysqldCheck if MySQL port is active:
netstat -tunlp | grep 3306
Configure Password for Remote Connection
Enter the printed password to log in to MySQL:
mysql -u root -pAfter logging in, change the root password:
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';Check user information:
select user, host, ssl_type from mysql.user; use mysql;Update the host field to
%to allow remote connections:update user set host = '%' where user = 'root';Refresh privileges:
flush privileges;
Adding Archive Platform Fields
Log in to MySQL:
mysql -u root -pCreate a database:
create database filing;Add data from the provided SQL file:
use filing; source /usr/local/filing.sql;Check the added tables:
use filing; show tables;
As always, ensure that you adapt paths, filenames, and other specifics to match your system's configuration.