To access phpMyAdmin from XAMPP you will need to make sure you have Apache and MySQL running in the XAMPP control panel by clicking the start buttons under the Actions column:
If Apache and MySQL are green then all is well. Then you can click the “Admin” button in the MySQL row and that will launch phpMyAdmin:
You can also access phpMyAdmin by typing in http://localhost/phpmyadmin/ into your browser. The first time you access it, you will need to login using “root” as the username and there will be no password. Once you’ve typed that in, click on “Go”:
Once you are logged in I would recommend changing your password to secure your databases and their settings:
After you’ve done that. You will want to create a new database by clicking here:
You will then be prompted to name the database, do so, and then click on “Create”:
Then you will be asked to create a table with however many columns you want. Once you’ve decided that, click “Go” again:
This will require that you preplan your database a bit. You’ll need to know exactly what you will be storing in it. For this example, we will be storing the user’s name and age. So on the next screen we will put in a names and ages column. We will also need to give them a type, age will be INT (integer/numbers) and names will be VARCHAR (characters/letters). Finally we will need to say how many characters can be in each column. Age will be 3 since I don’t think anyone would live to be older than 999 (: and we will give 100 characters for their name which should be enough. Once we filled in those fields, we would click “Save”:
And there you have it! A new database with a table with two columns in it ready to be filled. Be sure to watch the video at the top of this post if you want to see how to connect to the database using PHP Data Objects (PDO). Also, be sure to check out our if you want to learn more about PHP, databases, and how to use them together. Have an amazing day!
Comments
Post a Comment