- SSH into your server.
- Log into MySQL as the root user.
- Create a new database user:
GRANT ALL PRIVILEGES ON *.* TO 'db_user'@'localhost' IDENTIFIED BY '[email protected]$w0rd123!';
NOTE: Be sure to modifydb_user
with the actual name you would like to give the database user, as well as,[email protected]$w0rd123!
with the password to be given to the user. - Log out of MySQL by typing:
\q
. - Log in as the new database user you just created:
mysql -u db_user -p
NOTE: Be sure to modifydb_user
with the actual database user name. Then, type the new database user’s password and press Enter. - Create the new database:
CREATE DATABASE db_name;
NOTE: Be sure to modifydb_name
with the actual name you would like to give the database.