.

Maintain Unmanaged VPS – Part 4: Create or Bin MySQL DBs using the Terminal

English   English (change)

Maintain Unmanaged VPS – Part 4: Create or Bin MySQL DBs using the Terminal

mysql database logo

This how-to guide maps out two pretty basic but handy MySQL operations, creating and binning a database, using the terminal interface.

Sure, you can do those with, say, phpMyAdmin, but it’s way quicker to perform such functions using the CLI.

Substitute “db_username”, “db_password”, “db_password” and “db_name” with those of your own.

[sniplet guvSellBox]
[sniplet vpsIndexSell]

Add a MySQL Database

From the command line interface, we need first to access the mysql shell:-

[text]mysql -u root -p[/text]

And before actually creating the db, you need to set up the database user and password.

[text]grant all privileges on *.* to db_username@localhost identified by “db_password”;[/text]

Now create the db:-

[text]create database db_name;[/text]

And exit the MySQL shell:-

[text]quit[/text]

Delete a MySQL Database

Easy tiger! From the command line interface, we need first to access mysql:-

[text]mysql -u root -p[/text]

And delete the sucker:-

[text]delete database db_name;[/text]

And here’s an alternative way to exit the MySQL shell:-

[text]q[/text]
[sniplet vpsIndex]

.