linux installation example of redis and mysql
- 2020-06-23 02:37:32
- OfStack
Install redis and mysql in linux environment
Install redis (version 3.2.10) :
Download address: https: / / redis io/download, I download 3.2.10 here
// Unpack the
tar zxvf redis-3.2.10.tar.gz
cd redis-3.2.10
make
cd src
make install
// Set up the redis Service background startup
cd ..
vi redis.conf
Set up the daemonize yes
// The installation redis service mkdir -p It means recursive creation So it's created at the same time /usr/local/redis and /usr/local/redis/bin
mkdir -p/usr/local/redis/bin
mkdir -p/usr/local/redis/ect
cp redis.conf /usr/local/redis/etc/redis.conf
// Start the redis service
cd src
redis-server /usr/local/redis/etc/redis.conf
// test Use a client connection
redis-cli
Install mysql (version 5.6.33) :
Download address: http: / / mirrors sohu. com/mysql/MySQL - 5.6 /, here I choose mysql - 5.6.36 - linux - glibc2. 5 - i686. tar. gz
# Unpack the
tar -zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
# Copy and unzip mysql directory
cp -r mysql-5.6.33-linux-glibc2.5-x86_64 /usr/local/mysql
# Add user groups
groupadd mysql
# Add user mysql To the user group mysql
useradd -g mysql mysql
cd /usr/local/mysql/
mkdir ./data/mysql
chown -R mysql:mysql ./
./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/mysql --pid-file=/usr/local/mysql/data/mysql.pid
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
cp support-files/my-default.cnf /etc/my.cnf
# Modify the startup script
vi /etc/init.d/mysqld
# Modify the item:
basedir=/usr/local/mysql/
datadir=/usr/local/mysql/data/mysql
# Start the service
service mysqld start
# Test the connection
./mysql/bin/mysql -uroot
# Add environment variables and edit /etc/profile This can be used anywhere mysql The command
export PATH=$PATH:/usr/local/mysql//bin
source /etc/profile
# Start the mysql
service mysqld start
# Shut down mysql
service mysqld stop
# View health status
service mysqld status
Create mysql Remote Access account:
mysql -u root -p
# Create a remote access account
create user rootweb@'%' identified by '123456';
grant all privileges on *.* to rootweb;
flush privileges;