230
Appendix B Getting Started with MySQL
rw rw 1 mysql mysql 0 Apr 30 14:30
udphdr.MYD
rw rw 1 mysql mysql 1024 Apr 30 14:30
udphdr.MYI
[root@laptop]#
As you may have figured out, there are three files related to each table in the data
base. To find out how many databases are present on your system, just list the directo
ries under
/usr/lib/mysql
.
Basic MySQL Commands
This section presents some very basic MySQL commands. These commands are
required to do basic operations with the database.
Creating a Database
First of all you have to login to create a database. You can login as user root to
MySQL server as shown below. This root user is not the Linux root user. It is related to
MySQL database only.
[root@conformix /root]# mysql u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 3.23.36
Type help; or \h for help. Type \c to clear the buffer
mysql>
At the mysql> prompt, you can use MySQL commands. The following com
mand creates testdb.
mysql> create database testdb;
Query OK, 1 row affected (0.01 sec)
mysql>
When you create a database, a directory is created under /var/lib/mysql to
store database files. In this case the name of the directory is /var/lib/mysql/
testdb.
Displaying a List of Databases
At the command prompt, you can use the show databases command to list
available databases.
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