drop – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Thu, 27 May 2021 11:56:42 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How to Delete A MySQL User Account https://tecadmin.net/delete-mysql-account/ https://tecadmin.net/delete-mysql-account/#respond Thu, 27 May 2021 11:56:42 +0000 https://tecadmin.net/?p=25271 MySQL is an relational database management system provide authentication mechanism to prevent unauthorized access. It keeps all the user details in a database named “mysql”. You must have super user access (eg: root) to access this database. In this article you will learn to find accounts in a MySQL server and remote unnecessary user accounts. [...]

The post How to Delete A MySQL User Account appeared first on TecAdmin.

]]>
MySQL is an relational database management system provide authentication mechanism to prevent unauthorized access. It keeps all the user details in a database named “mysql”. You must have super user access (eg: root) to access this database.

In this article you will learn to find accounts in a MySQL server and remote unnecessary user accounts.

View Current Users

Connect to the existing MySQL server using administrative privileged account.

mysql -u root -p 

Next, list all the available user account in MySQL server. Default database named “mysql” contains system related details including user account under “user” table.

SELECT User,Host FROM mysql.user; 

List MySQL Users

List out the account with hostname to delete or all unused accounts no longer required.

Drop/Delete MySQL User

Use DROP USER statement is used to delete one or more accounts from MySQL. It also removes privilege rows for the account from all grant tables. You must have specified username along with hostname as per showing in above screenshot.

For example, to remove user “dummy” with host “localhost”, execute below query:

DROP USER 'dummy'@'localhost';

drop mysql user

The above command drop only those user from MySQL maches both username and hostname.

Let’s use another example to delete user “myuser” with hostname “%”, execute below query.

DROP USER 'myuser'@'%';

delete mysql user

That’s it. Repeat the same command to remove more accounts no longer required.

Conclusion

This tutorial describes you to how to remove user accounts from MySQL database server.

The post How to Delete A MySQL User Account appeared first on TecAdmin.

]]>
https://tecadmin.net/delete-mysql-account/feed/ 0
How to Create and Drop database in MongoDB https://tecadmin.net/create-and-drop-database-in-mongodb/ https://tecadmin.net/create-and-drop-database-in-mongodb/#comments Thu, 01 May 2014 10:53:41 +0000 https://tecadmin.net/?p=5271 In earlier articles we have provided the steps to install MongoDB on CentOS and RHEL or Ubuntu and Debian Systems. Now find this article to how to create and drop database in MongoDB. 1. Create Database in MongoDB It’s strange to listen but true that MongoDB doesn’t provide any command to create databases. Then the [...]

The post How to Create and Drop database in MongoDB appeared first on TecAdmin.

]]>
In earlier articles we have provided the steps to install MongoDB on CentOS and RHEL or Ubuntu and Debian Systems. Now find this article to how to create and drop database in MongoDB.

mongodb-medium-logo

1. Create Database in MongoDB

It’s strange to listen but true that MongoDB doesn’t provide any command to create databases. Then the question is how would we create database ?. The answer is – We don’t create database in MongoDB, we just need to use database with your preferred name and need to save a single record in database to create it.

List Databases – First check the current databases in our system.

# mongo
> show dbs;
admin  (empty)
local  0.078GB
test   0.078GB

Use New Database –
Now if we want to create database with name exampledb. Just run following command and save a single record in database. After saving your first example, you will see that new database has been created.

> use exampledb;
> s = { Name : "TecAdmin.net" }
> db.testData.insert( s );

List Databases –
Now if you list the databases, you will see the new database will be their with name exampledb.

> show dbs;
admin  (empty)
local  0.078GB
exampledb   0.078GB
test   0.078GB

2. Drop Database in MongoDB

MongoDB provides dropDatabase() command to drop currently used database with their associated data files. Before deleting make sure what database are you selected using db command.

> db
exampledb

Now if you execute dropDatabase() command. It will remove exampledb database.

> db.dropDatabase();
{ "dropped" : "exampledb", "ok" : 1 }

To delete MongoDB database from Linux command line or Shell Script – Use following command from

# mongo exampledb --eval "db.dropDatabase()"

References:
1. http://docs.mongodb.org/manual/tutorial/getting-started/
2. http://docs.mongodb.org/manual/reference/command/dropDatabase/

The post How to Create and Drop database in MongoDB appeared first on TecAdmin.

]]>
https://tecadmin.net/create-and-drop-database-in-mongodb/feed/ 4