MongoDB – Copy Database

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 More

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 More

MongoDB – Show Databases

MongoDB show databases Use show dbs command from mongo shell to list all the available databases on MongoDB server. This will show the database name with there size. Example: > show dbs local 0.000GB mydb 0.001GB tecadmin 0.083GB You can select any database using the use statement and work on it.

Read More

MongoDB – Create Database

MongoDB Create Database MongoDB does not provide commands to create a database. You can use use dbName statement to select a database in the mongo shell. Use the following example: Syntax: > use DATABASE_NAME Limitations MongoDB database names cannot be empty and must have fewer than 64 characters. Create Database First, of the all, Use below command to select database. To create a new database make sure it not exists. > use mydb You have a database name selected. Now you need to insert at least one document to keep…

Read More

MongoDB 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 More

MySQL – 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 More

MySQL – 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 More

MySQL – 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 More

SQL – 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 More

MySQL 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