When you want to setup PHP development environment on your local PC or Mac, XAMPP is the easy, free and most popular option. Except XAMPP, you can also use MAMP or other similar tools to setup PHP development environment on local computers. If you want to install a web app, like Drupal, Joomla!, WordPress, and many other popular open source apps on the XAMPP server or MAMP server, you need to create a MySQL database for these web apps. See this guide to install WordPress on Mac using XAMPP, just as an example. These software provides us phpMyAdmin as the database manager. In this article, we will show you the quick steps to create a MySQL database in phpMyAdmin on your PC or Mac.
If you use XAMPP on a Windows PC, launch XAMPP, then start both Apache and MySQL services from XAMPP Control Panel. Then you can access phpMyAdmin from URL http://localhost/phpmyadmin/
Now you open the phpMyAdmin in your web browser. Follow below instructions to create a MySQL database, create a new user and add the user to database in phpMyAdmin on your computer.
Steps to create a database in phpMyAdmin
- Click on the ‘Databases‘ tab;
- Specify a Database name;
- Click ‘Create‘ button and you are done.
Note that leave everything else as-is, don’t select a collation.
Steps to create a user and add user to database in phpMyAdmin
- Click on the newly created database from the left pane.
- Click on its ‘Privileges‘ tab from top toolbar. If you can’t find it, click on More to expand the menu and choose Privileges, see below screenshot.
- In ‘New‘ group, click ‘Add user account‘ to start creating a new database user.
- Basically what you need to change is the fields in the Login Information group. Here you need to choose a User name, select local/localhost as the Host name, type in the same password twice, leave everything else as-is.
- Scroll down to the page bottom and click the Go button to create a new user and add it to the selected database in phpMyAdmin on PC.
Note that you need only to grant all privileges on the newly created database. Do not select any global privileges/permissions from the Global Privileges group, as this user only needs all privileges/access on the specific database.