Skip to Content

Creating a Database for New Sites

Each site should have its own database. That is, we don't recommend using table prefixes on an existing database because a) you can create as many databases as you like and b) you run the risk of potential conflicts if more than one sites uses the same database.

  1. Create a new database for the new site using the following command line (replacing the values appropriately)

    mysqladmin -uadmin -pYourPassword create Database_Name

  2. Give the database a new MySQL user and full privileges to that user.

    mysql -uadmin -pYourPassword Database_Name

    Note: this will take you into the MySQL command line. Type the following and hit enter.

    GRANT ALL PRIVILEGES ON Database_Name.* TO NewUsername@localhost IDENTIFIED BY 'NewPassword';

    Note: keep 'localhost', but change 'Database_Name', 'NewUsername', and 'NewPassword'. Use something original for 'NewPassword', as you won't need to use it too often (that is, you will only need it when setting up a new site). A good rule is to use "example_com" for the database name, "exampledbuser" for the user, and a unique password.

    QUIT;

    Enter quit to exit out of MySQL.