標籤:mysql命令
create database test_db; 建立名為test_db資料庫
use test_db; 進入test_db資料庫
show tables; 查看資料庫裡有多少張表
drop database test_db ; 刪除資料庫
drop table test01 ; 刪除表
delete from test01 ; 清空表內容
show variables like ‘%char%‘; 查看資料庫字元集
insert into test01 values ("001","jf1"); 向表中插入資料。
select * from test01; 查看test01表資料內容。
create table test01 (id varchar(20),name varchar(20));
grant all privileges on test_db.* to [email protected] identified by ‘123456‘;
grant all on test_db.* to [email protected] identified by ‘123456‘;
grant select,insert,update,delete on *.* to [email protected]”%” identified by ‘123456’;給mysql資料庫授權。
flush privileges;重新整理許可權
mysqldump –uroot –p123456 test_db >/tmp/test.db.sql ;MySQL備份或匯出
mysql –uroot –p123456 test_db < /tmp/test.db.sql ;MySQL匯入
mysqladmin –uroot –p123456 password newpassword ;修改MySQL root密碼
drop database test_db ; 刪除資料庫
drop table test01 ; 刪除表
delete from test01 ; 清空表內容
show variables like ‘%char%‘; 查看資料庫字元集
insert into test01 values ("001","wugk1"); 向表中插入資料。
select * from test01; 查看test01表資料內容。
create table test01 (id varchar(20),name varchar(20));
alter table ip_can drop id;刪除某一欄位
alter table ip_can add id varchar(20);增加某一欄位
alter table ip_can add id varchar(20) first;增加欄位在第一行
後續持續更新中
本文出自 “毛毛鴨” 部落格,請務必保留此出處http://woshitieren.blog.51cto.com/2466034/1681211
mysql常用命令