電腦裏安裝了多種經常使用數據庫,可是又不會常常都用到,因此沒有設置開機啓動,可是時間長了常常忘記啓動命令,這裏總結一下,以便忘記是隨時查看。mysql
1、mongoDB
一、首先開啓mongo數據庫服務,mongod,它須要一直在後臺運行才能夠保證數據庫鏈接正常。redis
sudo service mongod start # 開啓
二、而後就能夠在終端啓動mongo了,也能夠用可視化工具如Robo3T鏈接sql
➜ ~ sudo service mongod start ➜ ~ mongo MongoDB shell version v3.4.18 connecting to: mongodb://127.0.0.1:27017 MongoDB server version: 3.4.18 Server has startup warnings: 2018-12-04T18:02:44.177+0800 I STORAGE [initandlisten] 2018-12-04T18:02:44.177+0800 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine 2018-12-04T18:02:44.177+0800 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem 2018-12-04T18:02:44.993+0800 I CONTROL [initandlisten] 2018-12-04T18:02:44.993+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database. 2018-12-04T18:02:44.994+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted. 2018-12-04T18:02:44.994+0800 I CONTROL [initandlisten] >
三、不用的時候能夠選擇關閉mongo後臺服務mongodb
sudo service mongod stop # 關閉
2、MySQLshell
一、啓動MySQL服務:數據庫
sudo service mysql start # 方式一 sudo /etc/init.d/mysql start # 方式二
啓動後能夠看看狀態:ubuntu
➜ init.d service mysql status ● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en Active: active (running) since 二 2018-12-04 13:55:17 CST; 4h 18min ago Process: 1112 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=ex Process: 1096 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exit Main PID: 1111 (mysqld) CGroup: /system.slice/mysql.service └─1111 /usr/sbin/mysqld 12月 04 13:55:16 zzf-ubuntu systemd[1]: Starting MySQL Community Server... 12月 04 13:55:17 zzf-ubuntu systemd[1]: Started MySQL Community Server.
二、而後就能夠鏈接MySQL數據庫了,無論是終端、命令行、程序仍是可視化工具工具
➜ ~ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 5.7.24-0ubuntu0.16.04.1 (Ubuntu) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> ^DBye
三、關閉同mongo,改爲stop便可post
四、另外開啓時候也能夠重啓,使用restart命令便可。spa
3、Redis
一、服務啓動
經過指定配置文件啓動,要清楚本身的配置文件位置
redis-server /etc/redis/redis.conf
二、而後就能夠經過各類方式鏈接redis數據庫了
➜ ~ redis-cli 127.0.0.1:6379>
三、關閉Redis服務
redis-cli shutdown