MYSQL HOWTO ----------------------------------------------------- MYSQL GUI http://unix.cs.plattsburgh.edu:8008/phpmyadmin/ provides a GUI to mysql. Be aware that this GUI has a limited capability, and it is important to learn SQL, so that we can later embed SQL in programs external to the DBMS. ----------------------------------------------------- MYSQL TEXT BASED INTERFACE To run mysql client execute these commands in the shell: 1. ssh unix.cs.plattsburgh.edu 2. export EDITOR=pico mysql -u DBUSERNAME -D DBNAME -p OR JUST: mysql. (The dot following mysql is a part of the custom command name.) Your DBUSERNAME and DBNAME have been set to be the same as your Linux username. Ask the instructor for your database password. ----------------------------------------------------- HELP ON MYSQL To get help on mysql use any of the following 1. shell$ man mysql 2. shell$ mysql --help 3. mysql> help 4. www.mysql.com notice that we run MySQL 5.0. ----------------------------------------------------- MYSQL FEATURES TO FACILITATE WORK Try the following: 1. (First type in the shell: export EDITOR=pico) mysql> edit This puts the previous command into an editor. You can modify it. After you exit the editor, type the semicolon to execute the command. 2. mysql> system COMMAND executes an operating system command COMMAND from the MySQL prompt. 3. Test your commands in the interactive mode. Once they work the way you intended, type them into a file FILE.sql. You will be able to execute this file from mysql mysql> source FILE.sql 4. mysql> tee sql.log This logs the session to file sql.log mysql> notee This ends the logging. 5. Use "exit" or "quit" commands to leave mysql. The same features are available in other relational database management systems (Postgres, Oracle, SQL Server, ...) but may require a different syntax. ----------------------------------------------------- ABOUT SQL 1. SQL, prenounced "sequel", is the standard language for creating, manipulating and querying relational databases. The same core SQL language is used in MySQL, Postgres, Oracle and SQL Server but these different implementations extend core SQL in different ways. 2. SQL is case insensitive; however table names in MYSQL are case sensitive; Attribute names and keywords are not. 3. Every SQL statement ends with a semicolon. 4. Use the "commit" command to preserve your changes or "rollback" command to undo them. Commit or rollback end a transaction and start a new one; once you committed to a change, you cannot rollback that change. 5. See http://www.w3schools.com/sql/default.asp tutorial. =====================================================