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 unlimitednmongod - cpu unlimitednmongod - as unlimitednmongod - memlock unlimitednmongod - nofile 64000nmongod - rss unlimitednmongod - 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