国产宅男网站在线|亚洲A级性爱免费视频|亚洲中精品级在线|午夜福利AA毛

  • <dd id="gf5jf"><th id="gf5jf"></th></dd>

    <cite id="gf5jf"><label id="gf5jf"></label></cite>
  • <div id="gf5jf"><listing id="gf5jf"></listing></div>
    學(xué)習(xí)啦 > 學(xué)習(xí)電腦 > 操作系統(tǒng) > Linux教程 > linux查詢數(shù)據(jù)庫(kù)命令

    linux查詢數(shù)據(jù)庫(kù)命令

    時(shí)間: 佳洲1085 分享

    linux查詢數(shù)據(jù)庫(kù)命令

      在linux系統(tǒng)中有相關(guān)的命令可以讓我們對(duì)mysql數(shù)據(jù)庫(kù)做相關(guān)的操作,那么具體是哪些命令呢?下面由學(xué)習(xí)啦小編為大家整理了linux查詢數(shù)據(jù)庫(kù)命令的相關(guān)知識(shí),希望對(duì)大家有幫助!

      1.linux查看數(shù)據(jù)庫(kù)的命令

      mysql> show databases;

      查看數(shù)據(jù)表的詳細(xì)結(jié)構(gòu)

      mysql> desc funtb;

      2.linux操作數(shù)據(jù)庫(kù)的相關(guān)命令

      新建數(shù)據(jù)庫(kù)

      mysql> create database school;

      新建表

      mysql> create table user01(

      -> id varchar(20) NOT NULL,

      -> userName varchar(10) NOT NULL,

      -> age int(11) default'0',

      -> sex char(2) NOT NULL default'm',

      -> PRIMARY KEY (id)

      -> )TYPE=InnoDB;

      Query OK, 0 rows affected, 1 warning (0.02 sec)

      mysql>desc student;

      插入

      mysql> insert into student(id,stuName) values('1','tomcat');

      刪除

      mysql> delete from student where id='1';

      刪除表中所有數(shù)據(jù)

      mysql> truncate table student;

      刪除表

      mysql> drop table temp;

      創(chuàng)建新用戶并給予權(quán)限

      mysql> grant all privileges on *.* to dbuser@localhost identified by '1234'

      with grant option;

      更改Mysql用戶密碼

      c:\Mysql5.0\bin>mysqladmin -u root -p password 1234

      Enter password: ****

      備份數(shù)據(jù)庫(kù)及表(新版數(shù)據(jù)庫(kù)不加3306端口號(hào))

      c:\mysql\bin\>mysqldump –u root –p mydb >d:\backup.sql

      執(zhí)行此語(yǔ)句將把數(shù)據(jù)庫(kù)mydb 備份到D盤的backup.sql文件中

      備份多個(gè)數(shù)據(jù)庫(kù)表

      c:\mysql\bin\>mysqldump –u root –p 3306 school user01 user >d:\backup.sql

      此句的意思是把school庫(kù)中的user01表和user表的內(nèi)容和表的定義備份到D盤backup.sql文件中。

      備份所有的數(shù)據(jù)庫(kù)

      c:\myql\bin>mysqldump –u root –p 3306 –all –database>d:backup.sql

      還原Mysql數(shù)據(jù)庫(kù)

      c:\mysql\bin\mysql –u root –p 3306 school

      還原其中的一個(gè)表

      mysql> source d:\books.sql;

      退出Mysql連接

      mysql>quit(exit)

      windows關(guān)閉mysql服務(wù)

      C:\mysql\bin>net mysql

    3590432