For New Users of MySQL
231
mysql> show databases;
+ +
| Database |
+ +
| mysql |
| test |
| testdb |
+ +
3 rows in set (0.00 sec)
mysql>
This command shows that three databases exist. The names of these databases are
mysql, test and testdb.
Connecting to a Database
To connect to a database, you can use the use command by providing the name of
the database as the argument to this command. The following command starts using
testdb as the database.
mysql> use testdb;
Database changed
mysql>
In some cases you can also use the following command:
mysql> connect testdb
Reading table information for completion of table and column
names
You can turn off this feature to get a quicker startup with A
Connection id: 3
Current database: testdb
mysql>
Creating Tables
The following command creates a table with the name customer. The table con
tains four columns.
mysql> create table customers (name varchar(20), address
varchar(40), phone varchar(10), dob date);
Query OK, 0 rows affected (0.00 sec)
mysql>
Column names and their data types are defined in the command. When you create
a table, three files are created in the directory that corresponds to the database. In this
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved