MySQL Basic Commands

How to Connect to MySQL

To start working with MySQL, you’ll need to establish an active SSH session on your server.

mysql -u root -p

If you didn’t set a password for your MySQL root user, you omit the -p switch.

Create a new MySQL User Account

Next, you can create a new test user for practice. To do that, run the following command:

CREATE USER ‘username’@’localhost’ IDENTIFIED BY ‘password’;

If you need to delete a user later on you, use this command:

DROP USER ‘someuser’@’localhost’;

Create a New Database

To set up a new database use this line: