| [002] Mysql - Create a new database -
01-03-2008
Create a new database
At the mysql> prompt, type: TIP: Unlike Linux commands, MySQL commands need a semicolon ( ; ) on the end to execute. If ever you mistakenly end a command string with no semicolon...
CREATE DATABASE us_presidents ...then press ENTER... ...there is no way to "fix" that command. To continue, just add a semicolon to the new line you are on:
CREATE DATBASE us_presidents
; If the command is valid, it will execute. If there was an error in the command string and it's invalid, adding a semicolon here will execute it and MySQL will give an error. Then you can continue from there.
CREATE DATABASE us_presidents;
Then press ENTER.
Type: SHOW DATABASES; then press ENTER. The window should look like this:
This shows the databases on your MySQL server: mysql, test, and us_presidents. The mysql database is used by the MySQL server to store information about users, permissions, etc. The test database is often used as a workplace for MySQL users to test and try things—this is useful in a work environment where many people are working with critical information. TIP: MySQL commands don't have to be UPPER-CASE. In this book, commands are put in upper-case to make them easier to distinguish. If you'd typed the command in lower-case:
show databases; that would have been fine. |