以下是在CentOS上从零开始安装数据库的步骤,以MySQL和PostgreSQL为例:
sudo yum update -ysudo wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm,sudo rpm -Uvh mysql80-community-release-el7-3.noarch.rpmsudo yum install mysql-server -ysudo systemctl start mysqld,sudo systemctl enable mysqldsudo grep 'temporary password' /var/log/mysqld.logsudo mysql_secure_installation,按提示设置新密码等mysql -u root -psudo yum update -ysudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-$(rpm -E %{rhel})-x86_64/pgdg-redhat-repo-latest.noarch.rpmsudo dnf -qy module disable postgresqlsudo yum install -y postgresql-server postgresql-contribsudo /usr/pgsql-版本号/bin/postgresql-setup initdbsudo systemctl start postgresql,sudo systemctl enable postgresqlsudo -i -u postgres,psql,ALTER USER postgres PASSWORD 'your_password';,\q