Creating a new mysql user on digital ocean

To create a new MySQL user on DigitalOcean, you'll need to follow these steps:

Step 1: Connect to your MySQL server

You can connect to your MySQL server using the following command:

mysql -u root -p

Replace root with the root username and p with the password you set when creating your DigitalOcean droplet.

Step 2: Create a new database

Create a new database for your user to use:

CREATE DATABASE mydatabase;

Replace mydatabase with the name of the database you want to create.

Step 3: Create a new user

Create a new user with a username and password:

CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypassword';

Replace myuser with the username you want to create and mypassword with the password you want to set.

Step 4: Grant privileges

Grant the new user privileges to use the database:

GRANT ALL PRIVILEGES ON mydatabase.* TO 'myuser'@'%';

This grants the user all privileges on the mydatabase database.

Step 5: Flush privileges

Flush the privileges to apply the changes:

FLUSH PRIVILEGES;

Step 6: Verify the user

Verify that the new user exists and has the correct privileges:

SELECT * FROM mysql.user WHERE User = 'myuser';

This should return a row with the new user's information.

Step 7: Connect as the new user

Connect to the MySQL server as the new user:

mysql -u myuser -pmypassword

Replace myuser and mypassword with the username and password you created.

That's it! You've successfully created a new MySQL user on DigitalOcean.

Note: Make sure to replace mydatabase, myuser, and mypassword with the actual values you want to use. Also, be sure to use a strong and unique password for your new user.