Preparing the AJAX Database
As an exercise for both using phpMyAdmin and working with MySQL, let’s create a database called ajax
, and create a MySQL user with full privileges to this database. You’ll use this database and this user for all the exercises in this book. Follow these steps:
Load
http://localhost/phpMyAdmin
in your web browser. If the configuration data you wrote inconfig.inc.php
was correct, you should see something like this:Write
ajax
in the Create a new database box, and then click the Create button.phpMyAdmin doesn’t have the visual tools to create new users, so you’ll need to write some SQL code now. You need to create a user with full access to the
ajax
database, which will be used in all the case studies throughout the book. This user will be called (surprise!) ajaxuser, and its password will be practical. To add this user, click the SQL tab at the top of the page, and write this code in it:GRANT ALL PRIVILEGES ON ajax.* TO ajaxuser@localhost IDENTIFIED BY “practical”
Note
SQL does sound a bit like plain English, but a few things need to be mentioned. The
*
inajax.*
means all objects in the ajax database. So this command tells MySQL “give all possible privileges to the ajax database to a user of this local machine called ajaxuser, whose password is practical”.Click the Go button.
Congratulations, you’re all set for your journey through this book. Have fun learning AJAX!