精品丰满熟女一区二区三区_五月天亚洲欧美综合网_亚洲青青青在线观看_国产一区二区精选

  • <menu id="29e66"></menu>

    <bdo id="29e66"><mark id="29e66"><legend id="29e66"></legend></mark></bdo>

  • <pre id="29e66"><tt id="29e66"><rt id="29e66"></rt></tt></pre>

      <label id="29e66"></label><address id="29e66"><mark id="29e66"><strike id="29e66"></strike></mark></address>
      學(xué)習(xí)啦>學(xué)習(xí)電腦>操作系統(tǒng)>Linux教程>

      linux下mysql創(chuàng)建庫命令

      時間: 佳洲1085 分享

        Linux下mysql數(shù)據(jù)庫要怎么通過命令來創(chuàng)建一個新的數(shù)據(jù)庫呢?下面由學(xué)習(xí)啦小編為大家整理了linux下mysql創(chuàng)建庫命令的相關(guān)知識,希望對大家有幫助!

        linux下mysql創(chuàng)建庫命令方法步驟

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

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

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

        mysql -uroot -p123

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

        下面來創(chuàng)建數(shù)據(jù)庫mydatabase

        create database mydatabase;

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

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

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

        那么如何退出mysql命令行呢?

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

        附:linux下一些常用的數(shù)據(jù)庫命令

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

        mysql> use TestDB;

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

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

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

        mysql> show databases;

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

        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) 讓操作及時生效;

        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用戶訪問數(shù)據(jù)庫的權(quán)限

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

        備注:hjh是Linux用戶名,123456是訪問mysql的密碼

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

        # mysql -uhjh -p123456

      3630012