MySQL及PostgreSQL安装小计
MySQL及PostgreSQL安装小计MySQL安装环境准备安装步骤查询有效的MySQL的yum源添加MySQL的yum源安装MySQL导出数据库中的DDLTroubleshootingPostgreSQL安装安装步骤参考资料MySQL安装环境准备OS: CentOS 7安装步骤查询有效的MySQL的yum源yum repolist all | grep mysql添加MySQL的yum源/et
·
MySQL及PostgreSQL安装小计
MySQL安装
环境准备
OS: CentOS 7
安装步骤
查询有效的MySQL的yum源
yum repolist all | grep mysql
添加MySQL的yum源
/etc/yum.repos.d/mysql-community.repo
# Enable to use MySQL 5.7
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
安装MySQL
yum install mysql-community-server
导出数据库中的DDL
mysqldump -d -u <user> -p <password> -h <host> <dbname> > exported.sql
mysqldump -d -u <user> -p <password> -h <host> --databases > exported.sql
mysqldump -d -u <user> -p <password> -h <host> --all-databases > exported.sql
Troubleshooting
- 如果遇到已有的旧版本的MySQL安装包的干扰,出现冲突,则查找然后卸载旧版本
yum search installed | grep <mariadb, xxx>
yum remove <xxx>
PostgreSQL安装
安装步骤
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum install -y postgresql10-server
sudo /usr/pgsql-10/bin/postgresql-10-setup initdb
sudo systemctl enable postgresql-10
sudo systemctl start postgresql-10
导出DDL
pg_dump -U <user_name> -h <host> <database> -p 3433 -s [-t <table_or_view_names>] -f <file name>.sql
参考资料
更多推荐
已为社区贡献2条内容
所有评论(0)