溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

MySQL數(shù)據(jù)庫管理常用命令總結(jié)

發(fā)布時(shí)間:2021-08-20 04:01:43 來源:億速云 閱讀:112 作者:chen 欄目:數(shù)據(jù)庫

這篇文章主要講解了“MySQL數(shù)據(jù)庫管理常用命令總結(jié)”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“MySQL數(shù)據(jù)庫管理常用命令總結(jié)”吧!

安裝利用RPM包安裝Mysql,設(shè)置TCP 3306端口的iptables。

root密碼管理設(shè)置root用戶的密碼admin -uroot password password。

修改root用戶的密碼mysqladmin -uroot -p password password。

數(shù)據(jù)庫,表管理進(jìn)入mysqlmysql -h hostname -uroot -p。

創(chuàng)建數(shù)據(jù)庫mysql> create database location。

導(dǎo)入數(shù)據(jù)結(jié)構(gòu)mysql -uroot -p location <./location.sql。

查看數(shù)據(jù)庫mysql> show databases;

進(jìn)入某個(gè)庫mysql> use location;

查看表信息mysql> show tables;

查看表結(jié)構(gòu)mysql> desc Contact;

改表名mysql> rename table Contact to Contact_new。

刪除庫mysql> drop database location。

刪除表mysql> drop table Contact。

授權(quán)部分建立用戶并授權(quán)mysql> grant all on location.* to gk1020@10.1.11.71 identified by gk1020。

取消授權(quán)mysql> revoke all on location.* from gk1020@10.1.11.71。

刷新權(quán)限mysql> flush privileges。

操作語句查詢mysql> select * from Contact。

mysql> select count(*) from Contact。

修改mysql> update Contact set RegTime=‘2008-01-01 00:00:00’ where id=1。

mysql> update Contact set RegTime=‘2008-01-01 00:00:00’,CID=1 where id=1。

插入mysql> insert into Contact values(,…)

mysql> insert into Contact(ID,CID,Contact) values(,…)

刪除mysql> delete from Contact where id=1。

導(dǎo)出導(dǎo)出數(shù)據(jù)庫locationmysqldump -uroot -p location >./location.sql。

導(dǎo)出某個(gè)表mysqldump -uroot -p --database location --table Contact >./contact.sql。

導(dǎo)出數(shù)據(jù)庫location的數(shù)據(jù)結(jié)構(gòu)mysqldump -d -uroot -p location >./location.sql。

復(fù)制表復(fù)制表Contact為Contact_bakmysql> create table Contact_bak as select * from Contact。

復(fù)制表Contact的結(jié)構(gòu)mysql> create table Contact_bak as select * from Contact where 1=2。

查看正在執(zhí)行的任務(wù)mysql> show processlist。

感謝各位的閱讀,以上就是“MySQL數(shù)據(jù)庫管理常用命令總結(jié)”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對(duì)MySQL數(shù)據(jù)庫管理常用命令總結(jié)這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI