学习笔记

date 2019年04月13日 | category 学习笔记| 坏人咖啡

REDIS

cd /home/data/soft
wget http://download.redis.io/redis-stable.tar.gz
tar zxvf redis-stable.tar.gz
cd redis-stable
make -j 4
make install PREFIX=/home/data/app/redis
cp /home/data/soft/redis-stable/redis.conf /home/data/config/redis.conf
cp /home/data/soft/redis-stable/redis.conf /home/data/config/redis_slave.conf

自动启动加入/etc/rc.d/rc.local

/home/data/app/redis/bin/redis-server /home/data/config/redis.conf &

/home/redis/bin/redis-server /home/redis/redis.conf &

MYSQL

cd /home/data/soft
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz
tar zxvf mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.7.23-linux-glibc2.12-x86_64 /home/data/app/mysql
mkdir -p /home/data/data/mysql

nano /etc/my.cnf

内容如下

[client]

socket=/home/data/log/mysql.sock
port=3306

[mysqld]

datadir=/home/data/data/mysql
socket=/home/data/log/mysql.sock
port=3306

symbolic-links=0

log-error=/home/data/log/mysqld_error.log
pid-file=/home/data/log/mysqld.pid
character-set-server=utf8

cp /home/data/app/mysql/support-files/mysql.server /etc/init.d/mysql

nano /etc/init.d/mysql

内容如下

basedir=/home/data/app/mysql
datadir=/home/data/data/mysql

groupadd mysql
useradd -r -g mysql mysql
passwd mysql

修改个密码

chown -R mysql:mysql /home/data/app/mysql
cd /home/data/app/mysql/bin
./mysqld –initialize –user=mysql –basedir=/home/data/app/mysql –datadir=/home/data/data/mysql

启动MYSQL

./mysqld_safe –user=mysql &

修改密码 # 查看cat /home/data/log/mysqld_error.log中的密码

./mysql -u root -p
set password=password(‘新密码’);

自启动

chkconfig –add mysql
chkconfig mysql on

兼容程序启动时服务自启动慢 添加到/etc/rc.d/rc.local

/etc/rc.d/init.d/mysql start &

创建数据库

create schema test default character set utf8 collate utf8_general_ci;

创建用户 数据库授权

grant all privileges on test.* to ‘test’@’localhost’ identified by ‘123456’;
flush privileges;

所属分类: 学习笔记
Tags: , , ,


没有评论

暂无评论

RSS feed for comments on this post.

对不起,该文章的评论被关闭了!