Home » php tutorial » PHP – How to create a database? PHP – How to create a database? Last Updated on: November 2, 2020 by Anup Das Share on: In this tutorial, I’m going to teach you how to create a MySQL database for PHP. I’ll explain everything you need to create a database for your website.ContentsServer SetupCreating DatabaseCreate TablesCommon Datatypes1) Server SetupIf you are very new to web development please follow this tutorial to setup PHP on your computer. PHP Tutorial 1 – setup PHP on your computerNow, if you have done everything corrects our server will be ready to work. Next, we will open XAMPP control panel. Depending on where you have installed, you will need to look through the XAMPP directory and search for “xampp-control”. In the control panel run Apache and MySQL by clicking start. If you are using WAMP all the steps will be same as XAMPP.2) Creating DatabaseOpen any web browser and In URL type “localhost/phpmyadmin”. This will lead to phpmyadmin home page. From there click on Databases tab located on top. Now, under create database enter your database name(for example chat_db). Then click on create, leave ‘Collation’ as it’s.*Don’t give any space in the database name, you can use ‘_’.3) Create Tables Now on left side search for your database name. Then click on it, this will lead you to create a table.Here we are creating a table name “user_info”, which will have 3 columns.“user_info” table will have an id, username, password column. You can see table structure in below image,After you fill necessary information click on save.That’s all Congratulation you have successfully created a database in PHP – MySQL.4) Common data typesHere are some commonly used attributes in databases. You maybe need them when creating another database.Format: Column Name – Type – Length – Null Property – Other Propertiesemail – VARCHAR – 50 – not nullphone_no – VARCHAR -13 – not nulldate_of_birth – DATE – – not nulladdress – VARCHAR – 255 – not nullI would like to hear from you, tell me in comments below if you have any queries or feedback. 10 websites to get free images for website (2021 Edition) Top 10 free responsive blogger templates for 2021 which will make your blog look amazing PHP Tutorial 2 – Create a simple Login page part 2Anup DasI'm obsessed with python and write articles about python tutorials for Django, Data Science, and Automation.Stay Connected with ATTBe the first one to get the latest updates about python and django. 3 thoughts on “PHP – How to create a database?”OMG this looks so complicated for me! It's great you are able to do this tech stuff ReplyIt's not that complicated though.. ReplyVery straight forward tutorial ReplyLeave a Comment Cancel replyCommentName Email Save my name, email, and website in this browser for the next time I comment.