MySQL Admin
If you do any web development either with PHP, JSP, and/or Ruby on Rails you most likely will use MySQL. The following is all that you need to know to get started with MySQL. I am currently using MySQL 4.1.14. To install MySQL just unzipped it to the c:\ drive. To start the MySQL server cd to the bin directory and execute the following:
Once the server has started you can connect using the command line tool mysql. From a command prompt, just type the following:
Once logged on you can view the available databases by running this command:
To create a new database use the create command as in:
Of course, you will need to replace <database_name> with an appropriate name. To start using a specific database from those available enter the following command:
It is nice to list all the defined tables in a database schema, to do so in MySQL enter this next command:
And if you are like me and suffer from development amnesia, you will fail to remember those hardly ever used table column names. Well, the next command describes a given table’s metadata such as column name and type:
Once you have created your database and database tables, you will most likely need to create a user for that database schema. To create a user, execute the following:
And when you are done you can stop the server by executing the following:
There is a lot more to MySQL than this short tutorial. Like Oracle and other databases, MySQL provides import and export functionality (see load data command). In addition to the typical selects, updates, and delete statements these are the only other commands that I regularly use when using MySQL.
Technorati Tags: sql, mysql, mysqld, mysqladmin, crud, ddl, webdev, development















