笔记4-数据库的安装

1.MySQL的安装

--1--:
#下载MySQL的repo源
wget [http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm](http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm)
--2--:
#安装mysql-community-release-el7-5.noarch.rpm包
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
--3--:
#安装
yum install -y mysql mysql-server

1.1遇到的问题

Error:Package:mysql-community-server-5.6.42.el7.x86_64
      Requires:libstdc++.so.6(GLIBC_3.4.15)(64bit)
#解决思路:
cd /etc/yum.repos.d
sudo vi mysql-community.repo
--找到[mysql56-community]--
将enabled=1改为0
重新执行命令

1.2启动MySQL服务

启动MySQL

sudo service  mysqld start

停止、重启MySQL

sudo service  mysqld stop 
sudo service mysqld restart 

1.3修改密码

默认密码为空,直接回车就好

#登录mysql,
mysql -uroot -p
#输入命令
#newpass--自己输入要设置的密码
>>use mysql;
>>UPDATE user SET Password=PASSWORD('newpass') WHERE use ='root';
>>FLUSH PRIVILEGES#重载授权表
>>exit;#退出Mysql

1.4修改配置,允许root用户可以远程访问并拥有所有权限

#先登录mysql
>>mysql -u root -p"youpassword"
#授权
>>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;
#重载授权表
>>FLUSH PRIVILEGES;
#退出数据库
>>exit;

2.Redis安装

  • 基于内存的高效的非关系型数据库
#添加EPEL仓库
sudo yum install epel-release
#更新yum源
sudo yum install
#安装Redis
sudo yum -y install redis
#启动服务
sudo service redis start

2.1修改可以远程访问

vi /etc/redis.conf
将 bind 127.0.0.1 使用#注释掉,改为# bind 127.0.0.1(bind配置的是允许连接的ip,默认只允许本机连接;若远程连接需注释掉,或改为0.0.0.0)

2.2设置密码

将 requirepass foobared 注释去掉,foobared为密码,修改成自己的密码

猜你喜欢

转载自blog.csdn.net/weixin_33979745/article/details/87425167
今日推荐