Configuring MySQL
Most of your interaction with MySQL will be during the configuration and development of your Drupal Web site. This section verifies that your MySQL installation is correct and the database server is running.
Let's test that the server is working by connecting to the database named mysql using:
C:\Documents and Settings\Administrator> mysql -u root -p mysql |
You will be prompted to enter your password. You'll then see the prompt, similar to Listing 2 on your screen.
Listing 2. MySQL prompt from the command line.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 28 to server version: 4.0.26-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> |
If you see the preceding message, your MySQL server is running and correctly configured.
We are now going to create the Drupal database, drupal_db, and the user, drupal_user, that will own the database. Enter the MySQL commands shown in Listing 3 at the prompt (where password is the password for the drupal_user user).
Listing 3. Configuring MySQL from the command line
mysql> create database drupal_db;
mysql> grant select, insert, update, delete, create, drop, index, alter,
create temporary tables, lock tables
on drupal_db.* to 'drupal_user'@'localhost' identified by 'password';
mysql> flush privileges;
mysql> quit |
You can also use the grant privileges in Listing 4.
Listing 4. Simpler but less secure way to configure MySQL
mysql> grant all privileges on drupal_db.* 'drupal_user'@'localhost'
identified by 'password'; |
This is correct, but not as secure as the more verbose version in Listing 3. You do not want to use it on your production server. We will use the same command in development as in production to practice good security.
Now that MySQL is working, we can install and configure Drupal. Keep your command window open, because we will need it while we install Drupal.




