Mysql
From Linuxintro
Revision as of 08:30, 1 May 2009 by imported>ThorstenStaerk (→How to connect to mysql)
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:
staerk@tweedleburg:~> 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> select * from time_zone; Empty set (0.00 sec) mysql>