The basic operation of the MySQL database system Ubuntu

Under Ubuntu system after installing MySQL, the default directory for all databases newly created / var / lib / mysql directory, database users to create their own future default is saved in this directory. After the terminal input mysql Enter to start the mysql service, You can start typing commands Here are some of the most basic data manipulation commands:

1. show databases; # to see which databases exist

2. create database name; # create a database called the name of

3. use name; # to enter the (open) name name of the database

4. show tables; # to view the database table in which

5. create table tb1 (nid int, name varchar (20), pwd varchar (64)); # created in the database table named tb1, The table has three fields, the first field is called NID, is int type, the second outer field called name, is VARCHAR () type, length is 20, the first three fields named pwd, is VARCHAR () type, a length of 64

6. select * from tb1; # see all the data in the table tb1

7. insert into tb1 (nid, name, pwd) values ​​(1, 'alex', '123'); # tb1 insert a row in the table.

Guess you like

Origin www.cnblogs.com/iceberg710815/p/12079327.html