Skip to content

User Tutorials icon

Create a MySQL Database For Mambo

In this tutorial we will look at how to create a MySQL database for use with your Mambo site. The tutorial is the second in a series of three about getting started with Mambo.

Create a MySQL Database

There are two common methods you can use to create a MySQL database for your Mambo web site.

Create a Database Using phpMyAdmin

If you are comfortable with using phpMyAdmin to create a database, follow these steps.

Login to phpMyAdmin. Then do either of the following:

  1. Using the phpMyAdmin wizard, set your database connection collation to utf-8_unicode_ci;
  2. Enter your database name. For the sake of this tutorial we will call the database mambo.
  3. Set your database to utf8_general_ci;
  4. Click "Create".

Alternatively, run the following SQL query (after making sure your phpMyAdmin is set up to use utf8_unicode_ci or utf8_general_ci ):

mysqladmin -u root -p create mambo

Adding a Database User

While you can run your database under the root user, for security you should be adding a database user who only has access to the new database you have created. You should also only grant the privileges that are necessary for Mambo to use the database. To do this, enter phpMyAdmin and run the following SQL query:

GRANT ALL ON mambo.* TO '<database username>'@'localhost' IDENTIFIED BY '<password>';

NOTE: Replace <password> with your password, making sure you keep all other formatting, eg. 'mypassword'. Do the same with the <database username>. We use GRANT ALL to allow Mambo to do a complete install.

Create a Database and Add a User Through cPanel

It is much easier to create a database and add a user through cPanel if you are not familiar with using phpMyAdmin.

  1. Login to your cPanel server control panel;
  2. Locate the MySQL Database management icon on your cPanel's main control panel page;
  3. Clicking on this will take you to the database management screens where you will see options for creating new databases, adding users, and assigning users to your databases;
  4. In the entry field labelled "New Database", add the name for your database. For this tutorial, we are calling our database "mambo";
  5. Click "Create Database".

Your new database is automatically created. Now, we have to assign a user to this database.

NOTE: A database user is not a user in the sense of it being a human who logs in and manually runs database queries (although humans can, of course, also access the database if they know the user credentials). A database user is a set of access privileges that can be used by applications to read and write to and from the database.

To add a user, look at the text fields on your MySQL database management page, the same page you are on when you create a new database through cPanel.

  1. Enter the username you want to use, and a password (try to make these hard to guess) and click "Create User".
  2. On the same page, you will see an option to "Add Users To Your Databases";
  3. Use the dropdown boxes to select your database name and your database user;
  4. Place a check mark alongside Privileges ALL;
  5. Click on "Add User To Database".

Now, make a note of the following because you will use this information when you install Mambo:

  • Your MySQL database name;
  • Your MySQL user name;
  • Your MySQL user password.

Your database is now ready for you to install Mambo.

In the next tutorial we will go through the steps of installing Mambo.

Bookmark This:
  • bodytext
  • Technorati
  • del.icio.us
  • Facebook
  • Google
  • StumbleUpon
  • Reddit

Whether I am developing Mambo or working on tutorials I am fuelled by coffee. Caffeine keeps me going so if you like the work I am doing please click on the cup to buy me a coffee today. Just $10 covers the cost of getting my caramel macchiato ;)

If you enjoyed this article make sure you subscribe to my RSS feed!

Leave a Reply

This is a gravatar-friendly site, enter your email address to use your gravatar.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.