天天看點

mysql基礎操作指令

1.mysqladmin -uroot -p passwd '123456' 修改密碼,需要輸入就的密碼

2.mysql -uroot -p  登入資料庫

3.show databases;  顯示所有資料庫

4.use  mysql;      使用mysql資料庫

5.show tables;    顯示表

6.drop database bbs; 删除名為bbs的資料庫,這是個不可逆的操作,删除了就沒有了

7.create database bbs; 建立名為bbs的資料庫

8.mysql> create table t1 (

   -> id  int unsigned auto_increment not null primary key,

   -> name varchar(20) not null,

   -> age int not null default 20

   -> );

Query OK, 0 rows affected (0.21 sec)

   建立新表例子

9.DESC t1; 檢視t1這個表

10.insert into t1 (name,age) values ('me',24); 插入

11 select * from t1; 檢視表内容

12.delete from t1;  删除行

繼續閱讀