Environment: Any Linux VPS or Dedicated Server
Access Required: SSH root or MySQL root access
Step 1: Login to MySQL as Root
Connect to your server via SSH, then enter the following command to access MySQL:
mysql -uroot -p
Enter the MySQL root password when prompted.
Step 2: Create a New Database
Once inside the MySQL shell, create a new database:
CREATE DATABASE example_one;
Step 3: Create a MySQL User and Grant Privileges
Run the following command to create a user and grant full privileges to the new database:
GRANT ALL PRIVILEGES ON example_one.* TO 'exampleuser'@'localhost' IDENTIFIED BY 'SomERand0mPas$WorD' WITH GRANT OPTION;
Step 4: Exit MySQL
EXIT;
Note:
- You can change
example_one
,exampleuser
, and the password (SomERand0mPas$WorD
) to suit your needs. - Always use a strong password for security.