Need to create a database for your website there are multiple ways to do it.
In this tutorial, you can learn how to create a MySQL database using the command line interface (CLI).
If you are using a Linux server with MySQL but no cPanel, you can simply use putty.exe to create a MySQL database, database user, and password, as well as, assign all privileges to the user for the database.
STEP:1 SSH into your server as root.
STEP:2 Log into MySQL as root.
mysql -u root
STEP:3 Create a new database user.
GRANT ALL PRIVILEGES ON *.* TO 'db_user'@'localhost' IDENTIFIED BY 'P@s$w0rd123$';
NOTE: Be sure to modify db_user with your choice name, as well as, P@s$w0rd123$ with the password to be given to the user.
STEP:4 Log out of MySQL by typing: \q
.
STEP:5 Log in as the new database user you just created.
mysql -u db_user -p
NOTE: Be sure to modify db_user with the actual user name that you choose above.
Then, type the new database user’s password and press Enter.
STEP:6 Create a new database.
CREATE DATABASE db_name;
NOTE: Be sure to modify db_name with the actual name you would like to give the database.
To create a MySQL database using the Command Line Interface (CLI), you can follow these steps:
cssCopy code
mysql -u username -p
Replace “username” with your MySQL username. You will be prompted to enter your password.
sqlCopy code
CREATE DATABASE database_name;
Replace “database_name” with the desired name for your database.
sqlCopy code
SHOW DATABASES;
This command will display a list of all databases on the MySQL server, including the one you just created.
Copy code
USE database_name;
Replace “database_name” with the name of your database.
That’s it! You have successfully created a MySQL database using the command-line interface. You can now proceed to create tables and manage the data within your database.