MongoDB Copy Database Use copyDatabsae() function to copy MongoDB database from remote database instance to local database instance. You can also use this to copy database in the local instance as alternatives for rename database. Syntax: db.copyDatabase(fromdb, todb, fromhost, username, password, mechanism) Examples: Copy Database on Same Instance You can create a duplicate database in same instance by using copyDatabase() function. db.copyDatabase(“olddb”,”newdb”) Output: { “ok” : 1 } Also you can use above option to rename database in MongoDB. But you must have enough space to create a copy of…
Read MoreTag: database
MongoDB – Drop Database
MongoDB Delete Database The dropDatabase() command is used to delete the current database calculating all the associated data files. To remove any database first you need to select that database. You can use show dbs command to list available databases. > use mydb Now run the drop database command to delete the currently selected database. Before deleting any database, make sure to take backup Mongodb database. > db.dropDatabase() { “dropped” : “mydb”, “ok” : 1 }
Read MoreMongoDB – Show Databases
MongoDB show databases In MongoDB, you can use the show dbs command to list all databases on a MongoDB server. This will show you the database name, as well as the size of the database in gigabytes. Example: > show dbs Output local 0.000GB mydb 0.001GB tecadmin 0.083GB You can select any database using the use statement and work on it.
Read MoreMongoDB – Create Database
MongoDB Create Database Creating a new database with MongoDB is a straightforward process, but there are a few prerequisites that you need to consider before you can get started. In this article, I’ll walk you through the steps for creating a MongoDB database, as well as some common mistakes to avoid. By the end of this article, you’ll have the knowledge and confidence to create a new database with MongoDB quickly and easily. Syntax: > use DATABASE_NAME Limitations MongoDB database names cannot be empty and must have fewer than 64…
Read MoreMongoDB Tutorial
This is our new series of tutorials for MongoDB NoSQL database. In this tutorial list you will find most of the basic tutorial about MongoDB which will help you to learn MongoDB and work with it.
Read MoreMySQL – Show Databases
Use SHOW DATABASES statement to list all database on MySQL database server. First login to MySQL server with privileged user and list all databases. Command:- SHOW DATABASES; Example:- Login to your MySQL server using command line. You will get MySQL database prompt like mysql> . Now use SHOW DATABASES statement to list all database. mysql> SHOW DATABASES; +——————–+ | Database | +——————–+ | information_schema | | mysql | | mydb | | performance_schema | +——————–+ 4 rows in set (0.03 sec) You can also use the following command directly on…
Read MoreMySQL – Drop Database
Use DROP statement to delete database using MySQL query prompt. This tutorial will help you to delete MySQL database using the command line. Syntax:- DROP database_name; Example: Login to your MySQL server using command line. You will get MySQL database prompt like mysql> . Now use following command to connect mydb database. mysql> DROP mydb; Another Example: You can also use the following command directly on operating system command prompt without login to MySQL. This help users to automate task inside a script. mysqladmin -u root -p drop mydb
Read MoreMySQL – Select Database
In this chapter of MySQL Tutorial, You will learn how to use database in MySQL. Before executing any operation on database you must need to use that database. Syntax: USE database_name; Example: ogin to your MySQL server using command line. You will get MySQL database prompt like mysql> . Now use following command to connect mydb database. mysql> use mydb;
Read MoreSQL – Create Database
SQL CREATE DATABASE Use CREATE DATABASE statement to create a new database using mysql command. Login to MySQL server with administrative access to create a database. Syntax CREATE DATABASE database_name; Example Login to your MySQL server using the command line. You will get MySQL database prompt like mysql> . Now use CREATE DATABASE statement to create a database. mysql> CREATE DATABASE mydb; You can also use the following command directly on operating system command prompt without login to MySQL first. $ mysqladmin -u root -p create mydb To confirm that…
Read MoreMySQL Tutorial
This is the complete MySQL tutorial for beginner to learn SQL Database online. Using this MySQL tutorial you can learn how to use various MySQL query in the database.
Read More