Make a DB

Let's make databases we can play with.

You'll make two, one on localhost (your PC), and one on Reclaim. This is a good way to work. Get your code running on your PC, then make a duplicate DB on your server.

Localhost

In the XAMPP CP (control panel), start up Apache and MySQL. Then click on the DB admin button.

Starting phpMyAdmin

phpMyAdmin will start. It's a web app written in PHP, so it starts in a brower.

Now, MySQL has its own security system, separate from the OS. When you access a MySQL DB, you do so as a MySQL user. It's easier to create the user and the DB at the same time.

Ethan
Ethan

So MySQL users have nothing to do with my Reclaim user info?

Right. MySQL users are their own thing. You use them to connect to your DB in PHP programs, but that's all.

Click on the user accounts tab...

User accounts tab

... then the Add user account link:

Add user account link

A form for making a user account will appear. Fill in the user name and password fields. Check "Create database with same name and grant all privileges."

Form fields

I'm making a user with the name wombat, and a database called wombat as well.

Click the Go button (lower right of the page). You should see a confirmation message, and a new DB on the list:

User created

Reclaim account

Let's make the wombat DB on your Reclaim server.

The easiest way to do that is with cPanel. Easy is good. It's the same thing you did with phpMyAdmin on locahost, just with a slightly different interface.

Start cPanel. Look for the DB section. Start the wizard.

Starting the wizard

The wizard first asks for the name of the database. I'll name this one wombat, too.

DB name

DB names are a bit different on your server. They have extra stuff at the beginning.

Ethan
Ethan

Why is that?

You're the only person making DBs on your PC. If you make a DB called wombat, there's only one.

Your Reclaim account is different. To keep costs down, you share one Linux server with other people. What happens if a few of you create a wombat DB? Argh! Name collision.

Hmm. What to do?

Each Reclaim user has an account on their Linux server. You can see your Linux username on the main cPanel page:

Linux username

Your username is unique. Your server uses that fact to construct unique DB names.

If your username is rosie, your home directory will be /home/rosie. You can see that in the cPanel File Manager.

To keep your DB names unique, cPanel adds your Linux username to the front:

DB name

So the real name of the DB on the server is rosie_wombat.

Adela
Adela

Could I use the same name for the DB on localhost?

Yes, you could! Then they'd be the same. Good thinking! But you don't have to. I usually don't bother.

Click Next to go to the next step in the wizard. It asks you to create a user.

Creating a user

Again, your Linux name gets added to the front. Remember, this is just a MySQL user, not used for anything else.

Make sure you record the password somewhere, and click Create user.

Now add the user to the DB, with all privileges.

Add user to DB

Click Next step, and you're done.

Two DBs

You have two DBs, one on localhost, and the other on your Reclaim server. W00t!

Now, let's make a table on one DB, and export the result to the other.