Difference between revisions of "Mysql"
From Linuxintro
imported>ThorstenStaerk |
imported>ThorstenStaerk |
||
Line 73: | Line 73: | ||
mysql> | mysql> | ||
</pre> | </pre> | ||
+ | |||
+ | = See also = | ||
+ | * [http://man-wiki.net/index.php/1:mysql man page of the command mysql, the command to connect to the database mysql] |
Revision as of 13:29, 16 May 2009
MySQL is a free database. This article describes how to install it, start it and how to connect to it. It has been tested with SUSE Linux 11.1 but should work with any Linux.
Contents
How to install mysql
sudo /sbin/yast -i mysql
How to start the database
sudo /etc/init.d/mysql start
How to connect to mysql
mysql
How to work with mysql
Here is a short example how to work with mysql, including an SQL statement:
$ mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.0.67 SUSE MySQL RPM Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.01 sec) mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> show tables; +---------------------------+ | Tables_in_mysql | +---------------------------+ | columns_priv | | db | | func | | help_category | | help_keyword | | help_relation | | help_topic | | host | | proc | | procs_priv | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +---------------------------+ 17 rows in set (0.00 sec) mysql> desc time_zone; +------------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------+------------------+------+-----+---------+----------------+ | Time_zone_id | int(10) unsigned | NO | PRI | NULL | auto_increment | | Use_leap_seconds | enum('Y','N') | NO | | N | | +------------------+------------------+------+-----+---------+----------------+ 2 rows in set (0.00 sec) mysql> select * from time_zone; Empty set (0.00 sec) mysql>