MongoDB:
apt-get install mongodb
会自动创建db目录
输入mongo,进入交互界面
show dbs
use local
db.test.insert()
在mac 平台下
先安装homebrew
brew install mongdb
Redis安装
redis key:value形式
redis desktop manager 0.8.8 图形界面
port:6379默认
Linu下:
apt-get install redis-server
redis-cli进入命令行模式
举例:
set ’a' 'b'
get 'a'
配置文件:/etc/redis/redis.conf
bind 127.0.0.1
requirepass foobared 设置连接密码
重启redis服务
redis-cli -a 密码
mac下:
brew install redis
配置文件/user/local/etc/redis.conf
重启服务
brew sevices list
brew services restart redis
mysql
linux下安装
MySQL is no longer included with RHEL. You must download therepository from the MySQL site and install it directly. You can use the following commands to install MySQL.
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
sudo yum update
sudo yum install mysql-server
sudo systemctl start mysqld
或者
sudo apt-get install mysql-server mysql-client
安装mariadb
sudo yum install mariadb-server
sudo apt-get install mariadb-server
配置启动
sudo systemctl stop mysqld
/etc/my.cnf
InnoDB engine、MyISAM engine
查看使用的是什么引擎:mysql> show table status;
推荐配置:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
transaction-isolation = READ-COMMITTED
# Disabling symbolic-links is recommended to prevent assorted securityrisks;
# to do so, uncomment this line:
symbolic-links = 0
key_buffer_size = 32M
max_allowed_packet = 32M
thread_stack = 256K
thread_cache_size = 64
query_cache_limit = 8M
query_cache_size = 64M
query_cache_type = 1
max_connections = 550
#expire_logs_days = 10
#max_binlog_size = 100M
#log_bin should be on a disk with enough free space.
#Replace '/var/lib/mysql/mysql_binary_log' with an appropriate path for
your
#system and chown the specified folder to the mysql user.
log_bin=/var/lib/mysql/mysql_binary_log
#In later versions of MySQL, if you enable the binary log and do not
set
#a server_id, MySQL will not start. The server_id must be unique within
#the replicating group.
server_id=1
binlog_format = mixed
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M
# InnoDB settings
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 64M
innodb_buffer_pool_size = 4G
innodb_thread_concurrency = 8
innodb_flush_method = O_DIRECT
innodb_log_file_size = 512M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
sql_mode=STRICT_ALL_TABLES
开机启动:
sudo systemctl enable mysqld
启动:
sudo systemctl start mysqld
运行sudo /usr/bin/mysql_secure_installation #设置root密码,初始为空
也可以尝试进入
/etc/mysql/mysql.conf.d
vim mysqld.cnf
bind-address = 127.0.0.1 #把它注释掉就可以远程连接了
mac下安装mysql
brew install mysql