mysql 建庫建表建使用者

來源:互聯網
上載者:User

標籤:

1.建立資料庫

create database school;

2.使用資料庫

Use school;

3.建立使用者

create user [email protected] identified by ‘jame‘;

4.授權使用者(注意這裡是用了*哦,可以自己講school也替換成*號)

grant select,update,insert,create on school.* to [email protected] identified by ‘j ame‘;

5.取消授權(現在明白為啥直接敲privilege 沒用了吧?)

revoke select,update,insert,create on school.* from [email protected];

6.建立表

create table students(s_name varchar(10) not null,age int(3),sex char(1),heig ht int,s_no varchar(20) not null,primary key(s_no));

7.修改表名

alter table students rename to student;

8.修改列

alter table students change s_name name varchar(20) not null;

9.增加列

alter table student add class varchar(20);

10.刪除列

alter table student drop column class;

11.刪除表

drop table student;

12.刪除使用者

drop user jame;

13.刪除資料庫

drop database school;

查看資料庫的表結構方法 desc students; 或者 describe students; 另:mysql使用者進入控制台後無法切換使用者,只能先退出終端,再重新串連。

mysql 建庫建表建使用者

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.