Instructions on Setting MySQL User Account
For the examples in the book to execute correctly, you need to set up a user account that allows users to create, delete and modify a database. After MySQL is installed, follow the steps below to set up a user account (these steps assume MySQL is installed in its default installation directory):
- Open a Command Prompt and start the database server by executing the C:mysqlinmysqld script.
- Open another Command Prompt and change to the C:mysqlin directory. To start the MySQL monitor so you can set up a user account, execute the command
C:mysqlin>mysql -h localhost -u root
- For our examples, we set up a user account on the local computer (localhost) with the username set "jhtp6" and the password "jhtp6". To do this, execute the following commands in the Command Prompt created in Step 2:
mysql> USE mysql; mysql> INSERT INTO user SET Host='localhost', User='jhtp6', Password=PASSWORD('jhtp6'), Select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', Create_priv='Y', Drop_priv='Y', References_priv='Y', Execute_priv='Y'; mysql> FLUSH PRIVILEGES; mysql> exit;