Quantcast
Channel: Superfancy Industries » Coding
Viewing all articles
Browse latest Browse all 4

MySQL Administrator on Mac OSX Leopard: A Few Tips and Tricks

$
0
0

I mentioned in my previous article I’d show a couple of MySQL Administrator tricks so here goes. Many programmers like to use Terminal to do all MySQL administration tasks. It’s a great skill to have and one that can be picked up pretty easily and quickly when you get comfortable working with MySQL. I prefer to do everything visually so I can actually see what I’m doing. There’s no right or wrong way but a lot of advanced tasks require work in the Terminal. However GUI tools are perfect for everyday administration tasks.

Getting started in MySQL Administrator

I presume if you followed my previous article you downloaded the MySQL GUI Tools, if not go ahead and download and install them. When you first open MySQL Administrator you’ll get a login screen:

MySQL Admin Login

Where the button says “Skip” above it’ll say “Connect” for you… for some reason while taking screen shots it changed to “Skip.” Weird…

Working on the assumption that this is a fresh install of MySQL, you have not created a password for the “root” user. This is not a problem as you can easily do this after logging in to MySQL Administrator. Let’s not forget to tell MySQL Administrator where mysql.sock is located… expand “More Options” and put /var/mysql/mysql.sock in the box next to “Connect Using Socket.” So now the login screen should look like this:

MySQL Admin Screen

Go ahead and hit “Connect” and you’re in:

MySQL Admin Info

If you take a look at the icon’s up top you can begin to get an idea of what you can do with MySQL Administrator. You can run backups, monitor MySQL connections, view logs, create new databases and users, and a host of other things. Lets start off by assigning a password to “root” user. A little disclaimer… keep in mind that this is MySQL’s superuser of sorts and some people do not assign “root” a password. So with that out of the way, click on “Accounts” and highlight “root.” As you’ll see all you have to do is type a password in the box, then confirm it in the next box, then click “Save Changes:”

Adding a new MySQL user

Since we’re already in the “Accounts” tab, lets go ahead and create a new MySQL user. All you need to do is press the “Add New User” button which is the first button in the bottom left corner:

Add New User

So just type in the Login Information and press “Save Changes:”

Login Info

Creating a new database

So let’s move on and create a new database. Click on “Catalogs” and then the “Add” (aka +) symbol in the bottom left corner:

Add New Database

Name your new Schema (aka database) and press “Ok.” This creates an empty database ready for your next web application! I have a local installation of WordPress on my MacBook Pro so here is what that “Schema” looks like:

So cool! Now we need to go back and assign privileges to the user we created in the previous step so the database can be accessed in an app.

Assigning privileges to a user

So go back to the “Accounts” panel, expand the user you previously created, and click on “Schema Privileges.” Directly underneath the User are a list of “hosts.” Since we’re just working locally, we’ll assign privileges to “localhost.” But feel free to add privileges to the other “hosts” for this user. This is probably the most confusing task you’ll do with MySQL Administrator so pay close attention. Highlight “localhost” and the “schema” you want to add user privileges to:

Schema Privileges

Now you need to select all (shift + click) the privileges you want to grant under “Available Privileges.” I just went ahead and gave myself all available privileges:

Available Privileges

Next you’ll need to click the “Grant” button which is the one that has the “less than” character <. Now the privileges you assigned will be in the “Assigned Privileges” column:

Assigned Privileges

This was a head-scratcher for me when I first started using MySQL Administrator. If you ever run into any difficulties just hover over the area you have questions about and usually a tool tip will appear. Now your database is ready to tag team with PHP in your web app of choice!

Well this should get you off and running with MySQL Administrator. I really only scratched the surface of things that can be done. Just click around and check stuff out… that’s pretty much how I learned. Have fun…


Viewing all articles
Browse latest Browse all 4

Trending Articles