shell > mysql -h (hostname) -u (user) -p
-p = with password
mysql> SELECT VERSION(), CURRENT_DATE;
+-----------+--------------+
| VERSION() | CURRENT_DATE |
+-----------+--------------+
| 5.5.23 | 2012-05-06 |
+-----------+--------------+
1 row in set (0.02 sec)
exit the mysql command shell - (ctrl+c / quit)
cancel the current command - (\c)
SHOW EXISTING DATABASE
mysql> show databases;
CHANGE CURRENT USING DATABASE
shell> mysql -u username -p db_name
mysql> user db_name;
CREATE A NEW DATABASE
mysql> create database db_name;
SHOW CURRENT DATABASE OWNED TABLE
mysql> show tables;
CREATE A NEW TABLE
mysql> create table table_name (column1 type, column2 type, column3 type);
TYPE-> VARCHAR(NO); CHAR(NO); INT();FLOAT();DATE; BOOLEAN
SHOW TABLE DESC
mysql> describe table_name;
沒有留言:
張貼留言