亚洲欧美精品沙发,日韩在线精品视频,亚洲Av每日更新在线观看,亚洲国产另类一区在线5

<pre id="hdphd"></pre>

  • <div id="hdphd"><small id="hdphd"></small></div>
      學(xué)習(xí)啦>學(xué)習(xí)電腦>操作系統(tǒng)>Linux教程>

      linux mysql創(chuàng)建數(shù)據(jù)庫(kù)命令

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

        我們除了可以在mysql數(shù)據(jù)庫(kù)或phpmyadmin中登陸數(shù)據(jù)庫(kù)我們還可以使用linux中命令進(jìn)行創(chuàng)建,下面由學(xué)習(xí)啦小編為大家整理了linux mysql創(chuàng)建數(shù)據(jù)庫(kù)命令,希望大家喜歡!

        linux mysql創(chuàng)建數(shù)據(jù)庫(kù)命令步驟

        (1)首選用putty連接linux服務(wù)器,進(jìn)行命令行

        輸入MySQL -u+數(shù)據(jù)庫(kù)用戶 -p+數(shù)據(jù)庫(kù)密碼

        架設(shè)數(shù)據(jù)庫(kù)用戶是root 密碼是123,應(yīng)該是像下面這樣才是正確的:

        mysql -uroot -p123

        -u和-p連接數(shù)據(jù)庫(kù)用戶和密碼中間是不能有空格的

        (2)下面來(lái)創(chuàng)建數(shù)據(jù)庫(kù)mydatabase

        create database mydatabase;

        這樣一個(gè)名叫mydatabase的數(shù)據(jù)庫(kù)就創(chuàng)建好了

        show databases; 顯示所有數(shù)據(jù)庫(kù)列表

        drop database mydatabase; 刪除數(shù)據(jù)庫(kù)mydatabase

        (3)那么如何退出mysql命令行呢

        在終端輸入exit; 知道完全退出mysql命令行為止

        附后一些常用的命令

        (4) 制定TestDB數(shù)據(jù)庫(kù)為當(dāng)前默認(rèn)數(shù)據(jù)庫(kù)

        mysql> use TestDB;

        (5) 在TestDB數(shù)據(jù)庫(kù)中創(chuàng)建表customers

        mysql> create table customers(userid int not null, username varchar(20) not null);

        (6) 顯示數(shù)據(jù)庫(kù)列表

        mysql> show databases;

        (7)顯示數(shù)據(jù)庫(kù)中的表

        mysql> show tables;

        (8)刪除表customers

        mysql> drop table customers;

        (9)顯示customers表的結(jié)構(gòu)

        mysql> desc customers;

        (10) 向customers表中插入一條記錄

        mysql> insert into customers(userid, username) values(1, 'hujiahui');

        (11) 讓操作及時(shí)生效;

        mysql> commit;

        (12) 查詢customers中的記錄

        mysql> select * from customers;

        (12) 更新表中的數(shù)據(jù)

        mysql> update customers set username='DennisHu' where userid=1;

        (13) 刪除表中的記錄

        mysql> delete from customers;

        (14)授予hjh用戶訪問(wèn)數(shù)據(jù)庫(kù)的權(quán)限

        # grant select, insert, update, delete on *.* to hjh@localhost indentified by "123456";

        備注:hjh是Linux用戶名,123456是訪問(wèn)mysql的密碼

        (15)采用用戶名和密碼登錄mysql

        # mysql -uhjh -p123456

      linux mysql創(chuàng)建數(shù)據(jù)庫(kù)命令

      我們除了可以在mysql數(shù)據(jù)庫(kù)或phpmyadmin中登陸數(shù)據(jù)庫(kù)我們還可以使用linux中命令進(jìn)行創(chuàng)建,下面由學(xué)習(xí)啦小編為大家整理了linux mysql創(chuàng)建數(shù)據(jù)庫(kù)命令,希望大家喜歡! linux mysql創(chuàng)建數(shù)據(jù)庫(kù)命令步驟 (1)首選用putty連接linux服務(wù)器,進(jìn)行
      推薦度:
      點(diǎn)擊下載文檔文檔為doc格式
      3571625