{"_id":"54cfbf6e3995cf0d0006f6fc","project":"54cf411f9d09bb0d00a17a1c","version":{"_id":"54cf411f9d09bb0d00a17a1f","project":"54cf411f9d09bb0d00a17a1c","__v":14,"createdAt":"2015-02-02T09:19:27.656Z","releaseDate":"2015-02-02T09:19:27.656Z","categories":["54cf41209d09bb0d00a17a20","54cfb99bbba1a023008741af","54cfb9a65ff7e617002bbd7f","54cfba03bba1a023008741b6","54cfba0ebba1a023008741b8","54cfba19bba1a023008741b9","54cfba29bba1a023008741bb","54cfba345ff7e617002bbd87","54cfba3ebba1a023008741bc","54cfba473995cf0d0006f6f0","54e371b18ef7552300409bf2","54e37aa5e887c50d005ef629","555a4e9b147f91190092d137","56b0e91802f4bc0d006ce254"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"user":"54cfa8c8a8a4fd0d00b7fd1c","__v":15,"category":{"_id":"54cfb99bbba1a023008741af","pages":["54cfbacd5ff7e617002bbd8a","54cfbd635ff7e617002bbd90","54cfbf6e3995cf0d0006f6fc","54cfc0b0bba1a023008741c9"],"project":"54cf411f9d09bb0d00a17a1c","version":"54cf411f9d09bb0d00a17a1f","__v":4,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-02-02T17:53:31.393Z","from_sync":false,"order":0,"slug":"getting-started","title":"Getting Started"},"parentDoc":null,"updates":["55201f86d133b6190031254b","55c653317d8b8335007ebddd"],"next":{"pages":[],"description":""},"createdAt":"2015-02-02T18:18:22.533Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"MySQL\"\n}\n[/block]\n> For a detailed guide on using MySQL with Cloud9, have a look at [Setting up MySQL](https://community.c9.io/t/setting-up-mysql/1718).\n\nFrom the Terminal, run the following command:\n\n```\n$ mysql-ctl install\n```\n\nThe output will be:\n\n```\nMySQL 5.5 database added.  Please make note of these credentials:\n\nRoot User: username\nDatabase Name: c9\n```\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Setting a Password\",\n  \"body\": \"Because MySQL has a blank password by default, setup is significantly easier for users. Additionally, since developers generally don't (and often shouldn't) put sensitive/important data in a development environment like Cloud9, having no password on MySQL is rarely an issue.\\n\\nIf you do have sensitive data in the database in your workspace or if you feel safer locking down your database, you can simply change your MySQL password and lock down your database as you'd like to. See [Setting up MySQL](https://docs.c9.io/docs/setting-up-mysql#section-can-i-use-my-own-mysql-credentials-)\"\n}\n[/block]\n\nNow you can connect to the database using the ip 127.0.0.1 and the default port 3306. You can also test it using our tool from the Terminal:\n\n```\n$ mysql-ctl cli\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 24\nServer version: 5.5.37-0ubuntu0.14.04.1 (Ubuntu)\n\nCopyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.\n\nOracle is a registered trademark of Oracle Corporation and/or its\naffiliates. Other names may be trademarks of their respective\nowners.\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n\nmysql>  show databases;\n+--------------------+\n| Database           |\n+--------------------+\n| information_schema |\n| c9                 |\n| mysql              |\n| performance_schema |\n+--------------------+\n4 rows in set (0.15 sec)\n```\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"MongoDB\"\n}\n[/block]\n> For a detailed guide on using MongoDB with Cloud9, have a look at [Setting Up MongoDB](https://community.c9.io/t/setting-up-mongodb/1717).\n\nFirst, install MongoDB by running the following command from the [Terminal](doc:terminal):\n\n```\n$ sudo apt-get install -y mongodb-org\n```\n\nThen, from the terminal, run the following command to start Mongo:\n\n```\n$ mongod --bind_ip=$IP --nojournal\n```\n\nThe output will include:\n\n```\n...\nwaiting for connections on port 27017\n```\n\nNow you can open the mongo shell in a new Terminal, running following command:\n\n```\n$ mongo\n```\n\nTo stop the MongoDB instance press `Control + C` in the Terminal where `mongod` is running. Now have a look at the currently used database:\n\n```\n$ mongo\nmongo> db\ntest\n\ncd ~\nwget -O cf.tgz 'https://cli.run.pivotal.io/stable?release=linux64-binary&source=github'\ntar xvzf cf.tgz\n```","excerpt":"","slug":"setup-a-database","type":"basic","title":"Set Up a Database"}
[block:api-header] { "type": "basic", "title": "MySQL" } [/block] > For a detailed guide on using MySQL with Cloud9, have a look at [Setting up MySQL](https://community.c9.io/t/setting-up-mysql/1718). From the Terminal, run the following command: ``` $ mysql-ctl install ``` The output will be: ``` MySQL 5.5 database added. Please make note of these credentials: Root User: username Database Name: c9 ``` [block:callout] { "type": "info", "title": "Setting a Password", "body": "Because MySQL has a blank password by default, setup is significantly easier for users. Additionally, since developers generally don't (and often shouldn't) put sensitive/important data in a development environment like Cloud9, having no password on MySQL is rarely an issue.\n\nIf you do have sensitive data in the database in your workspace or if you feel safer locking down your database, you can simply change your MySQL password and lock down your database as you'd like to. See [Setting up MySQL](https://docs.c9.io/docs/setting-up-mysql#section-can-i-use-my-own-mysql-credentials-)" } [/block] Now you can connect to the database using the ip 127.0.0.1 and the default port 3306. You can also test it using our tool from the Terminal: ``` $ mysql-ctl cli Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 24 Server version: 5.5.37-0ubuntu0.14.04.1 (Ubuntu) Copyright (c) 2000, 2014, 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> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | c9 | | mysql | | performance_schema | +--------------------+ 4 rows in set (0.15 sec) ``` [block:api-header] { "type": "basic", "title": "MongoDB" } [/block] > For a detailed guide on using MongoDB with Cloud9, have a look at [Setting Up MongoDB](https://community.c9.io/t/setting-up-mongodb/1717). First, install MongoDB by running the following command from the [Terminal](doc:terminal): ``` $ sudo apt-get install -y mongodb-org ``` Then, from the terminal, run the following command to start Mongo: ``` $ mongod --bind_ip=$IP --nojournal ``` The output will include: ``` ... waiting for connections on port 27017 ``` Now you can open the mongo shell in a new Terminal, running following command: ``` $ mongo ``` To stop the MongoDB instance press `Control + C` in the Terminal where `mongod` is running. Now have a look at the currently used database: ``` $ mongo mongo> db test cd ~ wget -O cf.tgz 'https://cli.run.pivotal.io/stable?release=linux64-binary&source=github' tar xvzf cf.tgz ```