如何用cmd命令控制mysql資料庫

2021-07-09 03:07:48 字數 1993 閱讀 8124



cmd命令大全

show variables like 'character%';

//顯示自己的資料庫的編碼

chcp 65001  就是換成utf-8**頁 

chcp 936 可以換回預設的gbk 

chcp 437 是美國英語

set names gbk

//設定資料庫的編碼

show databases;

//顯示所有的資料庫

show tables;

//顯示所有的表單

c://切換盤

cd c:\

//切換目錄

連線mysql資料庫並修改root密碼

mysql -h localhost -u root -p

use mysql;

updata user set password=password("新密碼") where user="root";

flush privileges;

quit;

use lol_video;

//選擇使用哪個

顯示資料庫:show databases; 

顯示資料表:show tables; 

顯示表結構:describe 表名; 

建立庫:create database 庫名; 

刪除庫:drop database 庫名; 

使用庫:use 庫名; 

建立表:create table 表名 (字段設定列表); 

刪除表:drop table 表名; 

修改表:alter table t1 rename t2 

查詢表:select * from 表名; 

清空表:delete from 表名; 

備份表: mysqlbinmysqldump -h(ip) -uroot -p(password) databasename tablename > tablename.sql 

恢復表: mysqlbinmysql -h(ip) -uroot -p(password) databasename tablename < tablename.sql(操作前先把原來表刪除) 

增加列:alter table t2 add c int unsigned not null auto_increment,add index (c); 

修改列:alter table t2 modify a tinyint not null, change b c char(20); 

刪除列:alter table t2 drop column c; 

備份資料庫:mysql\bin\mysqldump -h(ip) -uroot -p(password) databasename > database.sql 

恢復資料庫:mysql\bin\mysql -h(ip) -uroot -p(password) databasename < database.sql 

複製資料庫:mysql\bin\mysqldump --all-databases > all-databases.sql 

修復資料庫:mysqlcheck -a -o -uroot -p54safer 

文字資料匯入: load data local infile \"檔名\" into table 表名; 

資料匯入匯出:mysql\bin\mysqlimport database tables.txt

//*************************=後盾學到的cmd命令*************************=//

執行命令前將目錄切換到盤的根目錄下例如

d:1.通過cmd命令視窗 匯入資料庫

mysql -uroot -p wenda < wenda.sql

2.進入到mysql匯入資料庫

use wenda;

source f:/wenda.sql;

3.匯出

mysqldump -uroot -p wenda > wenda_bak.sql

如何用cmd命令控制mysql資料庫

cmd命令大全 show variables like character 顯示自己的資料庫的編碼 chcp 65001 就是換成utf 8 頁 chcp 936 可以換回預設的gbk chcp 437 是美國英語 set names gbk 設定資料庫的編碼 show databases 顯示所有...

如何用cmd命令加密資料夾

如何用cmd命令加密資料夾?首先先從開始 執行中開啟cmd視窗。然後在cmd視窗中輸入如下命令 md d test.在d盤上建立乙個名為test.的資料夾。我們剛才在d盤建立的那個資料夾在普通方式是打不開的,不信你就試試。那麼我們如何才能開啟這個test.的資料夾哪?既然我們可以通過cmd命令能建立...

如何用cmd連線Mysql資料庫

通常我們在網路上看到的mysql教程和mysql工具書,裡面都是cmd命令和結果集。也許有一些初學者不懂在系統的哪jkglfs個角落輸入這些命令,或者啟動mysql的一些工具,下面教你怎樣進入這個mysql的cmd模式和基本的mysql的cmd操作。以window系統為例,首先,我們把滑鼠移動到左下...