Once you get connection with MySQL server,it is required to select a
particular database to work with. This is because there may be more than one
database available with MySQL Server.
A D V E R T I S E M E N T
Selecting MySQL Database from Command Prompt:
This is very simple to select a particular database from mysql> prompt. You
can use SQL command use to select a particular database.
Example:
Here is an example to select database called TUTORIALS:
[root@host]# mysql -u root -p
Enter password:******
mysql> use TUTORIALS;
Database changed
mysql>
Now you have selected TUTORIALS database and all the subsequent operations
will be performed on TUTORIALS database.
NOTE: all the database name, table names, table fields name are case
sensitive. So you would have to use prpoer names while giving any SQL command.
Selecting MySQL Database Using PHP Script:
PHP provides function mysql_select_db to select a database.It returns
TRUE on success or FALSE on failure.
Syntax:
bool mysql_select_db( db_name, connection );
Parameter
Description
db_name
Required - MySQL Database name to be selected
connection
Optional - if not specified then last opened connection by
mysql_connect will be used.
Example:
Here is the example showing you how to select a database.
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
Keywords:
Mysql Select Database, Mysql Tutorial, Mysql tutorial pdf, history of mysql, basic mysql, syntax use in mysql, mysql software download, learn mysql, mysql insert, mysql delete, mysql data types, mysql administrator.