SQL Statements – Create a database

As mentioned in earlier posts, SQL is an extremely important part of web development. Below is instruction on how to create a database in SQL. This is based on a Linux MySQL DBMS, but it should work (or be very similar) on other versions of SQL as well.

  1. Log in to MySQL by typing:
    • mysql -u username -p
  2. If you wish to see existing databases, type:
    • show databases;
  3. Now, we can create the new database. We will call the database “thisDatabase:”
    • create database thisDatabase;
  4. Then we need to assign permissions to a user. This can be a new or an existing user. We will use the user name, terry. The password will be set to password:
    • GRANT ALL ON thisDatabase.* TO terry@localhost IDENTIFIED BY “password”;

Congratulations, your database is set up. This is something that you will need to use if you are installing a content management system like WordPress, Drupal, or Xoops. You can read more about creating a database by clicking here.

Leave a Reply