Responses intermixed.  See below...

untz <[EMAIL PROTECTED]> wrote on 12/02/2005 10:43:41 PM:

> Hello again,
> 
> I am using OS X Tiger and MySQL 5 Community Edition with the 
> CocoaMySQL v0.7b2 client
>   (see: http://cocoamysql.sourceforge.net/beta.php ).
> 
> Am a MySQL newbie so please pardon my questions...
> 
> Here's what I did:
> 
> 1. Started the MySQL server...
> 
> 2. Launched mysql from the command prompt by typing in:
> 
> untz $ mysql -u root -p
> Enter Password:  ******
> 
> 3. After logging into mysql, I created the following database:
> 
> mysql> create database music_development to 'untz'@'localhost' 
> identified by 'paintball';
> 

MySQL databases do not have the concept of ownership. They are all global. 
You only need to say:

(@mysql CLI prompt) CREATE DATABASE music_development;

and you can test to see if your create statement worked by running 

(@CLI) SHOW DATABASES;

If your database is in that list, the command worked.

You appear to have mixed a CREATE DATABASE with a GRANT statement. To 
create a MySQL user you need to use a GRANT statement. If you want to 
create a MySQL user account with all normal DB privileges (but still 
cannot grant permission to others), this is how I would create the account 
and grant access the new database:

(@CLI) GRANT usage ON *.* to 'untz'@'localhost' IDENTIFIED BY 'xxxxxx';
(@CLI) GRANT ALL ON music_development to 'untz'@'localhost';

If the user account already exists, just run the second command. To see if 
there is already an account for the user 'untz' you can use this query:

(@CLI) SELECT user, host from mysql.user where user='untz';

The privilege "USAGE" is a keyword that actually means "the user can login 
but can't do anything" or "no privileges".
http://dev.mysql.com/doc/refman/5.0/en/privileges.html
http://dev.mysql.com/doc/refman/5.0/en/privileges-provided.html
http://dev.mysql.com/doc/refman/5.0/en/grant.html

> 4. Ran a SQL script (which is located under 'db' directory under the 
> root folder, 'music') which created a table named albums into this 
> database by typing:
> 
> music>mysql -u untz -p music_development <db/create.sql
> 
> Everything went successfully...

Maybe, maybe not. Log back into the CLI and do this:

(all @CLI) 
USE music_development;
SHOW TABLE STATUS;

If your script created the tables, you will see them listed. If it also 
populated the tables, you will see a value other than 0 for the column 
"Rows";

You do not need to drop to an OS command line to run scripts into MySQL, 
the MySQL CLI has the "source" command (abbreviated as ".") that will read 
a script and process it as user input.
http://dev.mysql.com/doc/refman/5.0/en/mysql-commands.html

> 
> 5. Minimized Terminal and launched CocoaMySQL v0.7b2.
> 
> 6. Put in the following information for the connection information:
> 
> Host: localhost
> User: untz
> Password: paintball
> Database: music_development
> Socket: /tmp/mysql.sock
> Port:
> 
> My question(s) are:
> 
> (1) What is the default port number for a freshly created database in 
> MySQL 5 Community Edition?

Databases do not listen on ports, the server does that. (As I said in your 
other thread) Unless you specified otherwise, the default port is 3306.

> 
> (2) Am I following all the right steps to locally connect to the 
> music_development database using CocoaMySQL v0.7b2?

I can't answer to that as I do not have a Mac to try with.

> 
> (3) How do I look for port numbers associated with specific databases 
> and change them in the MySQL monitor command prompt?

Again, all databases are hosted on a single port by the server that 
contains them. Multiple servers on the same machine *SHOULD NOT SHARE 
DATABASES*!! That would most likely cause some serious synchronization 
problems and would probably fail horribly if you tried it. If you do have 
a single-machine/multi-server setup (for testing, migration, or 
development purposes) and you have more than one server active at the same 
time, then each server must have it's own connection points (TCP/IP ports 
and UNIX sockets) and it's own set of databases.

> 
> Kindest regards!
> 
> With thanks,
> 
> Unnsse
> 

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine 

Reply via email to