好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 知識庫 > MySQL命令行下18個常用命令

MySQL命令行下18個常用命令

熱門標簽:電銷機器人好品牌門薩維l 中科嘉智人工智能電銷機器人 哈爾濱crm外呼系統價格 銀川電銷外呼系統定制 凱立德科技館地圖標注 做地圖標注都需要什么工具 西安400電話在哪里辦理 上海智能外呼系統需要多少錢 甘孜電話機器人廠家

在日常的網站維護和管理中,會用到非常多的SQL語句,
熟練使用對網站管理有很多好處,尤其是站群管理的時候。

下面列一些常用的命令做備記。

1、顯示數據庫
show databases
顯示表
show tables;

 2、創建用戶
創建root用戶密碼為123

use mysql; 
grant all on *.* to root@'%' identified by '123' with grant option; 
commit;

 3、修改密碼

grant all on *.* to xing@'localhost' identified by '123456' with grant option; 
update user set password = password('newpwd') where user = 'xing' and host='localhost'; 
flush privileges;

 4、創建數據庫testdb:

create database testdb;

 5、預防性創建數據庫:

create database if not testdb;

 6、創建表:

use testdb; 
create table table1( 
username varchar(12), 
password varchar(20));

 7、預防性創建表aaa:

create table if not exists aaa(ss varchar(20));

 8、查看表結構:

describe table1;

 9、插入數據到表table1:

insert into table1(username,password) values 
('leizhimin','lavasoft'), 
('hellokitty','hahhahah'); 
commit;

 10、查詢表table1:

select * from table1;

 11、更改數據:

update table1 set password='hehe' where username='hellokitty'; 
commit;

 12、刪除數據:

delete from table1 where username='hellokitty'; 
commit;

13、給表添加一列:

alter table table1 add column( 
 sex varchar(2) comment '性別', 
 age date not null comment '年齡' 
); 
commit;

14、修改表結構

從查詢創建一個表table1:

create table tmp as 
select * from table1;

15、刪除表table1:

drop table if exists table1; 
drop table if exists tmp;

16、備份數據庫testdb

mysqldump -h 192.168.3.143 -u root -p pwd -x --default-character-set=gbk >C:\testdb.sql

17、刪除數據庫testdb

drop database testdb;

18、恢復testdb數據庫
首先先建立testdb數據庫,然后用下面命令進行本地恢復

mysql -u root -pleizhimin testdb C:\testdb.sql

這18個MYSQL命令都是管理員在日常維護中經常會用到的,熟練使用這些命令會使你的工作非常輕松

您可能感興趣的文章:
  • CMD命令操作MySql數據庫的方法詳解
  • Mysql 命令行模式訪問操作mysql數據庫操作

標簽:那曲 平頂山 安徽 山南 浙江 濮陽 四川 安康

巨人網絡通訊聲明:本文標題《MySQL命令行下18個常用命令》,本文關鍵詞  MySQL,命令行,下,18個,常用,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《MySQL命令行下18個常用命令》相關的同類信息!
  • 本頁收集關于MySQL命令行下18個常用命令的相關信息資訊供網民參考!
  • 推薦文章