Some brief introduction to MySQL, with a few example commands.
mysql -u root -p
\h for help
\!h run file
mysql < test.sql
\!h creates database, drops if there is already one like it
DROP DATABASE IF EXISTS test;
CREATE DATABASE test CHARACTER SET = utf8 COLLATE = utf8_general_ci;
use test;
show tables;
\!h run a file with a verbose handle, to make it show what's happening
[vagrant@localhost sf_vm_share]$ mysql -v -v -v < test.sql
--------------
DROP DATABASE IF EXISTS test
--------------
Query OK, 0 rows affected (0.00 sec)
--------------
CREATE DATABASE test CHARACTER SET = utf8 COLLATE = utf8_general_ci
--------------
Query OK, 1 row affected (0.00 sec)
--------------
show tables
--------------
Empty set (0.00 sec)
\!h create a basic table
CREATE TABLE `test`.`davidtable` ( `id` INT NULL , `forename` VARCHAR(255) NOT NULL , `surname` VARCHAR(255) NOT NULL ,
`dob` DATE NOT NULL , PRIMARY KEY (`id`)) ENGINE = MyISAM;
\!h change a property of the table
ALTER TABLE `davidtable` CHANGE `id` `id` INT(11) NULL DEFAULT NULL AUTO_INCREMENT;
\!h add user data to the table
INSERT INTO `test`.`davidtable` (`id`, `forename`, `surname`, `dob`) VALUES (NULL, 'david', 'szczesniak', '1999-03-08');
INSERT INTO `test`.`davidtable` (`id`, `forename`, `surname`, `dob`) VALUES (NULL, 'Peter', 'Edwards', '1966-06-06'), (NULL, 'Dwight', 'Walters', '1970-09-12');