These are the notes for Feb 10, 2008. Start your MySQL server (if it's not running already) and get in as root. I use: ps -ef | grep dgerman Mine is not running. Start it: /nobackup/dgerman/mysql-5.0.22/step008 Up to this moment we have: a) a root account, we changed the password on it (step010 -- sp00n) b) step006, step007, step008 were used to install, initialize, start c) mysql_stop is used to stop the server d) connect_asroot is used to get into your MySQL server as root So now I get in in the only I set that up so far (as root, with password): -bash-3.2$ /nobackup/dgerman/mysql-5.0.22/connect_asroot Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.0.22-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> Type use mysql; then hit enter and you will get a new prompt. We now have to define our first user: create user '[username]'@'silo.cs.indiana.edu' IDENTIFIED BY '[password]'; We make two changes: the username and the password. create user 'lbird'@'silo.cs.indiana.edu' IDENTIFIED BY 'dribl'; Type edit at the mysql prompt and then you can edit as much as you need to. UW PICO(tm) 4.10 File: /tmp/sqlXRzVtX Modified create user 'lbird'@'silo.cs.indiana.edu' IDENTIFIED BY 'dribl'; [ Wrote 1 line ] -> ; Query OK, 0 rows affected (0.00 sec) mysql> The user was created. Now we need to define a database. In the .pdf we create a database called demoOne, here I create a database called: awards. I type create database awards; at the mysql> prompt then hit enter. Then I grant access to awards for lbird. mysql> create database awards; Query OK, 1 row affected (0.03 sec) mysql> grant all on awards.* to 'lbird'@'silo.cs.indiana.edu'; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye -bash-3.2$ We then get out as root and come as the user we created and start working. Let's create a connect_aslbird file that contains the command to connect as lbird: We start from: mysql --socket=/nobackup/dgerman/mysql/mysql.sock \ --port=13297 --host=silo.cs.indiana.edu -u dgerman -p We found this in 11.2 also it's just like connect_asroot with a --host switch. We need to change it: -bash-3.2$ pwd /nobackup/dgerman/mysql-5.0.22 -bash-3.2$ ls -ld conn* -rw-r--r-- 1 dgerman faculty 106 Feb 10 13:55 connect_aslbird -rwxr--r-- 1 dgerman faculty 82 Feb 6 11:47 connect_asroot -bash-3.2$ cat connect_aslbird mysql --socket=/nobackup/dgerman/mysql/mysql.sock \ --port=47066 --host=silo.cs.indiana.edu -u lbird -p -bash-3.2$ chmod u+x connect_aslbird -bash-3.2$ ./connect_aslbird Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.0.22-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> use awards; Database changed mysql> show tables; Empty set (0.00 sec) mysql> Side note: http://www.libraries.iub.edu/scripts/countResources.php?resourceId=59555 is link to Books24x7 where you can find tens of thousands of IT books. Now we go back to creating a few tables and running one query in our first database. create table performers ( username char(8) primary key, lastName char(32), firstName char(32) ); mysql> show tables; +------------------+ | Tables_in_awards | +------------------+ | performers | +------------------+ 1 row in set (0.00 sec) mysql> select * from performers; Empty set (0.00 sec) mysql> edit UW PICO(tm) 4.10 File: /tmp/sqluND5CN Modified insert into performers (firstName, lastName, username) values ("Jordan", "Crawford", "jcrawfor"), ("D.J.", "White", "djwhite"), ("Deandre", "Thomas", "dthomas"), ("A.J.", "Ratliff", "ajratlif"), ("Eric", "Gordon", "egordon"), ("Mike", "White", "mwhite"), ("Armon", "Bassett", "abassett"), ("Jamarcus", "Ellis", "jmellis"), ("Lance", "Stemler", "lstemler"); [ Wrote 12 lines ] -> ; Query OK, 9 rows affected (0.00 sec) Records: 9 Duplicates: 0 Warnings: 0 mysql> select * from performers; +----------+----------+-----------+ | username | lastName | firstName | +----------+----------+-----------+ | jcrawfor | Crawford | Jordan | | djwhite | White | D.J. | | dthomas | Thomas | Deandre | | ajratlif | Ratliff | A.J. | | egordon | Gordon | Eric | | mwhite | White | Mike | | abassett | Bassett | Armon | | jmellis | Ellis | Jamarcus | | lstemler | Stemler | Lance | +----------+----------+-----------+ 9 rows in set (0.00 sec) mysql> drop table performers; Query OK, 0 rows affected (0.00 sec) mysql> show tables; Empty set (0.00 sec) mysql> exit Bye -bash-3.2$ ./mysql_stop Enter password: -bash-3.2$