以下是在CentOS镜像中安装和配置数据库的常见方法:
sudo yum update -y
sudo yum install mysql-server -y
sudo systemctl start mysqld
,sudo systemctl enable mysqld
sudo grep 'temporary password' /var/log/mysqld.log
sudo mysql_secure_installation
mysql -u root -p
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-$(rpm -E %{rhel})-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo dnf -qy module disable postgresql
sudo yum install -y postgresql-server postgresql-contrib
sudo /usr/pgsql-版本号/bin/postgresql-版本号-setup initdb
sudo systemctl start postgresql-版本号
,sudo systemctl enable postgresql-版本号
postgresql.conf
和pg_hba.conf
设置监听地址等sudo -u postgres psql
,然后执行ALTER USER postgres PASSWORD 'your_password';