Linux系统:第十二章:AWS服务器X86架构安装配置Mysql与MongoDB

sudo passwd root

root

su root

cd /usr/local/

chmod 777 /usr/local/
上传文件到/usr/local下

安装MongoDB

(安装文件:链接:https://pan.baidu.com/s/1eZuuUaqBW_eQ7k6DkhSIgg
提取码:fe0r )

chmod u+x /etc/rc.local

echo never > /sys/kernel/mm/transparent_hugepage/enabled

echo never > /sys/kernel/mm/transparent_hugepage/defrag

echo ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ >> /etc/rc.local

echo ‘echo never > /sys/kernel/mm/transparent_hugepage/defrag’ >> /etc/rc.local

echo -e ‘mongod - fsize unlimited\nmongod - cpu
unlimited\nmongod - as unlimited\nmongod - memlock
unlimited\nmongod - nofile 64000\nmongod - rss
unlimited\nmongod - nproc 64000’ >> /etc/security/limits.conf

rpm -ivh ./mongodb-org-server-4.2.3-1.el7.x86_64.rpm

rpm -ivh ./mongodb-org-shell-4.2.3-1.el7.x86_64.rpm

rpm -ivh ./mongodb-org-mongos-4.2.3-1.el7.x86_64.rpm

rpm -ivh ./mongodb-org-tools-4.2.3-1.el7.x86_64.rpm

cp mongod.conf /etc/mongod.conf

mkdir -p /data/mongodb/{data,logs}

chown -R mongod:mongod /data/mongodb/

systemctl enable mongod

systemctl start mongod

数据目录: /data/mongodb/data 日志目录: /data/mongodb/logs

mongod --dbpath /data/mongodb/data --logpath /data/mongodb/logs/mongod.log

或者sudo service mongodb start启动

tail -10f /data/mongodb/logs/mongod.log

mongo localhost:27017

use admin

db.createUser({ user: “root”, pwd: “111111”, roles: [{ role: “userAdminAnyDatabase”, db: “admin” }] })

exit

mongo localhost:27017/admin -u root -p

111111

安装MySQL(参考的是这篇:Linux Centos7安装mysql5.7详细教程)

rpm -qa|grep mariadb

mariadb-libs-5.5.68-1.amzn2.x86_64

rpm -e --nodeps mariadb-libs-5.5.68-1.amzn2.x86_64

rm /etc/my.cnf

rpm -qa | grep mysql

cat /etc/group | grep mysql

cat /etc/passwd | grep mysql

groupadd mysql

useradd -g mysql mysql

passwd mysql

111111

tar -zxvf mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz

mv mysql-5.7.34-linux-glibc2.12-x86_64 mysql57

chown -R mysql mysql57

chgrp -R mysql mysql57/

cd mysql57/

mkdir data

chown -R mysql:mysql data

chmod 777 /etc

bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql57/ --datadir=/usr/local/mysql57/data/

cp ./support-files/mysql.server /etc/init.d/mysqld

chown 777 /etc/my.cnf

chmod +x /etc/init.d/mysqld

/etc/init.d/mysqld restart

chkconfig --level 35 mysqld on

chkconfig --list mysqld

chmod +x /etc/rc.d/init.d/mysqld

chkconfig --add mysqld

chkconfig --list mysqld

service mysqld status

export PATH=$PATH:/var/mysql57/bin

source /etc/profile

cat /root/.mysql_secret

k%PN.:5sq%%G

ln -s /usr/local/mysql57/bin/mysql /usr/bin

yum install libncurses.so.5

y

yum whatprovides libstdc++.so.6

yum install libstdc+±4.4.7-3.el6.i686

yum install libncurses*

service mysqld restart

mysql -uroot -p

k%PN.:5sq%%G

set PASSWORD = PASSWORD(‘111111’);

flush privileges;

Ctrl+Z

mysql -uroot -p

111111

grant all privileges on . to ‘root’@’%’ identified by ‘youpassword’ with grant option;

FLUSH PRIVILEGES;

exit

service mysqld restart

ln -s /usr/local/mysql57/bin/mysql /usr/bin/mysql57

yum install firewalld

firewall-cmd --list-all

firewall-cmd --permanent --add-port=3306/tcp

firewall-cmd --query-port=3306/tcp

firewall-cmd --list-all

mysql mongodb redis 密码都是111111

查看文档与文件:内部文件

redis安装文件:
链接:https://pan.baidu.com/s/1kNETolDoZLBz005K0q35lA
提取码:7jjq

怕你们还是不会,录制了mysql,redis,mongodb的视频:
链接:https://pan.baidu.com/s/113FLtycXCvLEcbC2n0_I2A
提取码:txpf

java小丑 CSDN认证博客专家 资深研发 博客专家 自媒体工作者
我是廖志伟,一名java开发工程师,CSDN博客专家,多年一线研发经验,曾就职多家互联网公司,任Java开发工程师职位,参与多个千万级并发互联网产品研发,对大型分布式,高并发及微服务架构有非常深入研究。
相关推荐
©️2020 CSDN 皮肤主题: 博客之星2020 设计师:CY__ 返回首页
实付 39.90元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值