How do I create users in MySQL, and how do I learn to use MySQL
September 30, 2005 8:32 PM   Subscribe

I want to learn PHP and MySQL. I just installed both onto my Mac OS 10.4.2 machine to serve as a sort of testing ground. I also downloaded CocoaMySQL. It's asking for a host, user and password. I assume the host is localhost. However, I can't figure out how to create a user. Can anybody help with that? Also, what would you recommend as the best learning resources for somebody who can get around HTML and CSS, but has very little programming experience?
posted by willnot to Computers & Internet (8 answers total)
 
It's a bit of a chicken and egg isn't it? In order to manage users you have to first connect to the database. For this reason Mysql usually ships with a "root" account without any password, with a stern warning that the first thing you need to do is log in as root and set one.

In terms of learning, phpMyAdmin is a good way to get a lot out of mysql but without having to use the command line client interface. I don't know what CocoaMySQL is but it sounds similar (although probably not web-based.)

In terms of learning, the MySQL manual is pretty good, so keep a copy of it handy at all times. I perfer to download the .chm version of it which allows for easy offline viewing / searching etc. I don't know if there is a Mac CHM reader, but you can also download the docs in plain .html format for local reference.

There are tons and tons of MySQL / PHP tutorials floating around on the web, so it's going to be hard to wade through them all. I suggest that for the time being you learn them independently of each other. That is, learn MySQL just by doing queries by hand and observing the result, modifying the query, repeat, etc. Don't try to write PHP code that accesses the database until you're more comfortable with everything (and always try your queries by hand first before you code them, to make sure you get the expected result.)

A good resource is onlamp.com's MySQL tutorial section. Particularly, the introductory series by John Paul Ashenfelter was pretty good. Scroll down to the bottom of that page and read all his articles in the reverse order they are listed, and you should get a decent start.
posted by Rhomboid at 9:33 PM on September 30, 2005


I don't like learning on the web. I did find this book excellent, though.
posted by dobbs at 10:08 PM on September 30, 2005


Chmox is a free CHM reader for the Mac I found looking up the PHP CHM docs, which I highly recommend. Download the version with notes and chances are when you search it for a specific problem you will find it already done and annotated half a dozen different ways.

When I started learning PHP I did a lot of googling for different tutorials, but after discovering that R'ing TFM is so useful and not-daunting in this case I haven't had much use for anything else. Not that a PHP/MySQL tutorial won't be helpful (the first google result looks pretty good), but you'll probably do most of your learning going through the language references.

Keep in mind that most of the web resources in this area completely ignore security for the sake of simplicity, and it's probably good if you read an article or two about SQL injection and sanitizing input sooner than later.

On preview, I'm going to spare you my anti-PHP spiel, I guess, you lucky dog you, but suffice it to say that there are a lot of really well implemented and internally cohesive web development frameworks out there and also there is PHP.
posted by moift at 10:21 PM on September 30, 2005


Again, not sure what CocoaMySQL is, but I installed MAMP on my machine. It installs like a breeze and gives you interchangable PHP 4.x and 5.x, MySQL and PHPMyAdmin.

As for learning, I prefer books. Paul Dubois' MySQL book was one I found excellent. The same publishers do PHP and MySQL one which is also very good.
posted by TheDonF at 12:00 AM on October 1, 2005


Marc Liyange has some good resources on setting up MySQL on OSX.

You can just cut and paste the commands into Terminal to set up the users and so on, plus he's got this StartUp Item thing that starts the SQL server whenever you start up the Mac.

I found SQLCourse very useful as a beginner. You actually get to interact with their server full of dummy data, by typing in a box, which is unique as far as I know.
posted by AmbroseChapel at 12:31 AM on October 1, 2005


I'm not sure what CocoaMySQL looks like, but I've always used Aqua Data Studio (http://www.aquafold.com) for my databasing needs. It's Java based so it will run on any platform that Java runs on and it can connect to most of the major databases (including MySQL). Also, it's free!
posted by yasny_jp at 12:17 PM on October 1, 2005


The PHP manual is really very good for getting started. Read Section 3 up 16 (go back for the rest later. You can go your whole life without using classes. But once you've got the basics, you should at least learn how to make your own functions), then skip to the built-in functions. The string functions are a good place to start. Then maybe move to the Array functions and the MySql functions.

Ask more questions on community webboards or better yet, find a helpful soul who knows the language and pester him or her.
posted by miniape at 6:28 PM on October 1, 2005


Excellent learning resource: Sam's Teach Yourself Php, Mysql and Apache in 24 Hours (Sams Teach Yourself S.)

Like dobbs, I don't like learning from a screen. This book was very handy. I did a mySQL for my final year Uni project which demanded that I learn the rudiments of PHP, then you can pick bits up from the web.

It also helps you set up all the parts together so that they work.
posted by jwhittlestone at 6:58 AM on October 3, 2005


« Older NYC n00b ISO mind blowing club experience   |   Mercury fillings Newer »
This thread is closed to new comments.