Creating a database on a VPS depends on the control panel you are running in your VPS. If you are not having a control panel in your VPS, you need to do it via command line or CLI.
To create MySQL database in a VPS with cPanel
This is same as that in a shared hosting account, you may check out our tutorial for this.
To create MySQL database in a VPS with Plesk
- Login to your Plesk user panel.
- Go to Databases section.
- Click on Add Database.
- In the add databases page, just add the database name, the default MySQL user who has the privilege to access the database and also assign the related website from the drop down you can see in the screenshot above.
- Click Ok.
To create database in a VPS with no control panel
In this case you need to do this via Command line or CLI. MySQL server should be installed in the server. How to install MySQL can be found here.
- Login to the server via SSH/Shell.
- Run the following commands.
mysql -u root -p
Type in password when prompted and press ‘Enter’. This will open up a MySQL shell which looks like this.
In the MySQL Shell, run:
mysql>CREATE DATABASE db_name;
Create a MySQL user user who can access the database.
mysql>CREATE USER [email protected];
Grant permissions for the MySQL user to access the database.
mysql> GRANT ALL ON db_name.* TO [email protected] IDENTIFIED BY ‘your_password’;
Replace db_name, db_user. your_password with the actual database name, MySQL user who an access the database and its password.
If you run into any problems, just click on the Chat box below and talk to one of our support tech.