Question

How to connect a mySQL database with a website

Posted June 14, 2021 129 views
UbuntuMySQLDatabasesUbuntu 20.04

Hi @all,

Would you please make a tutorial, how to connect a mySQL database with a HTML website? Or is there already a guideline and I didn´t find it?
If possible in German but English would also be OK.

I want to create a database and connect it to my website. On the website there will be a forum and other things. To comment in the forum a user registration is needed beforehand, so I think I will need a database for storing the user data.
Or is there another solution for this and I don´t need a mySQL database? On my dedicated root server I have Ubuntu 20.04 installed.

Best regards
heusmich

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi there,

In order to have your website communicate with a MySQL database, you would need a server-side language to do this for you.

You could use a Language like PHP for example or Python. The language would depend on the skillset that you and your team have and your personal preferences.

You can take a look at this article on how to install PHP and MySQL on your server:

https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-20-04

Alternatively, you could use a CMS like WordPress which would allow you to build a forum/blog without actually doing much coding as you will be able to install some freely available plugins.

You can follow the steps here on how to install WordPress on your server:

https://www.digitalocean.com/community/tutorials/how-to-use-the-wordpress-one-click-install-on-digitalocean-2

Hope that this helps!
Regards,
Bobby

by Erika Heidi
The LEMP software stack is a group of software that can be used to serve dynamic web pages and web applications written in PHP. This is an acronym that describes a Linux operating system, with an Nginx (pronounced like “Engine-X”) web server. The backend data is stored in a MySQL database, and dynamic processing is handled by PHP. In this guide, we'll set up a LEMP stack on an Ubuntu 20.04 server.